summaryrefslogtreecommitdiff
path: root/libiberty/fibheap.c
diff options
context:
space:
mode:
authormatz <matz@138bc75d-0d04-0410-961f-82ee72b054a4>2009-05-29 02:55:25 +0000
committermatz <matz@138bc75d-0d04-0410-961f-82ee72b054a4>2009-05-29 02:55:25 +0000
commit9644542ebb5f25b574b9788a9a8d26507bf8483d (patch)
tree1054b8879314bf73c51c08f767623896079f9da3 /libiberty/fibheap.c
parenta6877bb4a96f3b6f9f8ad9236071eb216a1cce21 (diff)
downloadgcc-9644542ebb5f25b574b9788a9a8d26507bf8483d.tar.gz
* fibheap.c (fibheap_replace_key_data): Make sure we don't early
out when forcing the minimum. (fibheap_delete_node): Assert that we managed to force the minimum. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@147968 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libiberty/fibheap.c')
-rw-r--r--libiberty/fibheap.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/libiberty/fibheap.c b/libiberty/fibheap.c
index c032149c0c2..a37ee4ef270 100644
--- a/libiberty/fibheap.c
+++ b/libiberty/fibheap.c
@@ -214,7 +214,10 @@ fibheap_replace_key_data (fibheap_t heap, fibnode_t node,
node->key = key;
y = node->parent;
- if (okey == key)
+ /* Short-circuit if the key is the same, as we then don't have to
+ do anything. Except if we're trying to force the new node to
+ be the new minimum for delete. */
+ if (okey == key && okey != FIBHEAPKEY_MIN)
return odata;
/* These two compares are specifically <= 0 to make sure that in the case
@@ -256,6 +259,11 @@ fibheap_delete_node (fibheap_t heap, fibnode_t node)
/* To perform delete, we just make it the min key, and extract. */
fibheap_replace_key (heap, node, FIBHEAPKEY_MIN);
+ if (node != heap->min)
+ {
+ fprintf (stderr, "Can't force minimum on fibheap.\n");
+ abort ();
+ }
fibheap_extract_min (heap);
return ret;