aboutsummaryrefslogtreecommitdiff
path: root/libiberty
diff options
context:
space:
mode:
authorMichael Matz <matz@suse.de>2009-05-29 02:55:25 +0000
committerMichael Matz <matz@gcc.gnu.org>2009-05-29 02:55:25 +0000
commit4cfaf1ec98904cdf03c4759628d115e90ab03666 (patch)
tree1054b8879314bf73c51c08f767623896079f9da3 /libiberty
parent5ff8e3a454a83c9d9822ad3f982394f992a6ce30 (diff)
downloadgcc-4cfaf1ec98904cdf03c4759628d115e90ab03666.zip
gcc-4cfaf1ec98904cdf03c4759628d115e90ab03666.tar.gz
gcc-4cfaf1ec98904cdf03c4759628d115e90ab03666.tar.bz2
fibheap.c (fibheap_replace_key_data): Make sure we don't early out when forcing the minimum.
* 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. From-SVN: r147968
Diffstat (limited to 'libiberty')
-rw-r--r--libiberty/ChangeLog6
-rw-r--r--libiberty/fibheap.c10
2 files changed, 15 insertions, 1 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 850979a..837dbda 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,9 @@
+2009-05-29 Michael Matz <matz@suse.de>
+
+ * 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 <gingold@adacore.com>
* config.h-vms: Rewritten. Define configure macros.
diff --git a/libiberty/fibheap.c b/libiberty/fibheap.c
index c032149..a37ee4e 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;