X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=libiberty%2Ffibheap.c;h=a37ee4ef270a55d9df7d47c5722272a9b5f78cab;hb=c59e4eb006120b8dbd6b2d8b38f61601d1699f64;hp=e1d818c28939f3a628dae5c689f6d8fe86a5ba69;hpb=8858115ecd90fe07d0a95c42b929420e4bf0d1a4;p=pf3gnuchains%2Fgcc-fork.git diff --git a/libiberty/fibheap.c b/libiberty/fibheap.c index e1d818c2893..a37ee4ef270 100644 --- a/libiberty/fibheap.c +++ b/libiberty/fibheap.c @@ -16,8 +16,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ +the Free Software Foundation, 51 Franklin Street - Fifth Floor, +Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -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;