]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/fibonacci_heap.h
Correct a function pre/postcondition [PR102403].
[thirdparty/gcc.git] / gcc / fibonacci_heap.h
index 9961648d505ae99e13c94c14ef05fc6d9f2fd00a..a0f444be52b2f425a1410ad85147c60f2c3e8ded 100644 (file)
@@ -1,5 +1,5 @@
 /* Fibonacci heap for GNU compiler.
-   Copyright (C) 1998-2019 Free Software Foundation, Inc.
+   Copyright (C) 1998-2021 Free Software Foundation, Inc.
    Contributed by Daniel Berlin (dan@cgsoftware.com).
    Re-implemented in C++ by Martin Liska <mliska@suse.cz>
 
@@ -648,17 +648,18 @@ template<class K, class V>
 void fibonacci_heap<K,V>::consolidate ()
 {
   const int D = 1 + 8 * sizeof (long);
-  auto_vec<fibonacci_node<K,V> *, D> a;
+  fibonacci_node<K,V> *a[D];
   fibonacci_node<K,V> *w, *x, *y;
   int i, d;
 
-  a.quick_grow_cleared (D);
+  memset (a, 0, sizeof (a));
 
   while ((w = m_root) != NULL)
     {
       x = w;
       remove_root (w);
       d = x->m_degree;
+      gcc_checking_assert (d < D);
       while (a[d] != NULL)
        {
          y = a[d];