]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/fibonacci_heap.c
PR fortran/95090 - ICE: identifier overflow
[thirdparty/gcc.git] / gcc / fibonacci_heap.c
index 906a4362a0f2d3f5523c4be31ef4231a7e590de6..03811e4a314e6ab0c2b62eda66f1e8d9691b1f81 100644 (file)
@@ -1,5 +1,5 @@
 /* Fibonacci heap for GNU compiler.
-   Copyright (C) 2016-2018 Free Software Foundation, Inc.
+   Copyright (C) 2016-2020 Free Software Foundation, Inc.
    Contributed by Martin Liska <mliska@suse.cz>
 
 This file is part of GCC.
@@ -21,6 +21,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
+#include "alloc-pool.h"
 #include "fibonacci_heap.h"
 #include "selftest.h"
 
@@ -38,13 +39,14 @@ typedef fibonacci_heap <int, int> int_heap_t;
 static void
 test_empty_heap ()
 {
-  int_heap_t *h1 = new int_heap_t (INT_MIN);
+  pool_allocator allocator ("fibheap test", sizeof (int_heap_node_t));
+  int_heap_t *h1 = new int_heap_t (INT_MIN, &allocator);
 
   ASSERT_TRUE (h1->empty ());
   ASSERT_EQ (0, h1->nodes ());
   ASSERT_EQ (NULL, h1->min ());
 
-  int_heap_t *h2 = new int_heap_t (INT_MIN);
+  int_heap_t *h2 = new int_heap_t (INT_MIN, &allocator);
 
   int_heap_t *r = h1->union_with (h2);
   ASSERT_TRUE (r->empty ());
@@ -169,12 +171,13 @@ static void
 test_union ()
 {
   int value = 777;
+  pool_allocator allocator ("fibheap test", sizeof (int_heap_node_t));
 
-  int_heap_t *heap1 = new int_heap_t (INT_MIN);
+  int_heap_t *heap1 = new int_heap_t (INT_MIN, &allocator);
   for (unsigned i = 0; i < 2 * TEST_HEAP_N; i++)
     heap1->insert (i, &value);
 
-  int_heap_t *heap2 = new int_heap_t (INT_MIN);
+  int_heap_t *heap2 = new int_heap_t (INT_MIN, &allocator);
   for (unsigned i = 2 * TEST_HEAP_N; i < 3 * TEST_HEAP_N; i++)
     heap2->insert (i, &value);
 
@@ -196,12 +199,13 @@ static void
 test_union_of_equal_heaps ()
 {
   int value = 777;
+  pool_allocator allocator ("fibheap test", sizeof (int_heap_node_t));
 
-  int_heap_t *heap1 = new int_heap_t (INT_MIN);
+  int_heap_t *heap1 = new int_heap_t (INT_MIN, &allocator);
   for (unsigned i = 0; i < TEST_HEAP_N; i++)
     heap1->insert (i, &value);
 
-  int_heap_t *heap2 = new int_heap_t (INT_MIN);
+  int_heap_t *heap2 = new int_heap_t (INT_MIN, &allocator);
   for (unsigned i = 0; i < TEST_HEAP_N; i++)
     heap2->insert (i, &value);
 
@@ -219,8 +223,9 @@ test_union_of_equal_heaps ()
 
 /* Dummy struct for testing.  */
 
-struct heap_key
+class heap_key
 {
+public:
   heap_key (int k): key (k)
   {
   }