From: DJ Delorie Date: Fri, 29 May 2009 03:01:15 +0000 (+0000) Subject: merge from gcc X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0dc69033a0bf41ec851f19ca191949bf95e19b2c;p=binutils-gdb.git merge from gcc --- diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 850979abb9a..837dbdaca4d 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,9 @@ +2009-05-29 Michael Matz + + * 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. + 2009-05-25 Tristan Gingold * config.h-vms: Rewritten. Define configure macros. 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;