[committed] Fix PR54704

Message ID CAO2gOZX=FUzpdNFBvmy_HGBMefYamNm_TB6GTwHavkxoPPQjkw@mail.gmail.com
State New
Headers show

Commit Message

Dehao Chen Sept. 25, 2012, 9:28 p.m.

This patch (fixed by Richard, I just helped testing) fixes a bug in
the hash function which leads to too many collisions and a 3x compile
time overhead for tramp3d. After applying the patch, the compile time
of tramp3d returns to normal (the same as no block-location patch).

Bootstrapped and passed all gcc regression tests.

As the bug itself is obvious, I'll check in the patch to trunk now.


2012-09-25  Dehao Chen  <dehao@google.com>

        PR middle-end/54704
        * line-map.c (location_adhoc_data_hash): Fix the hash function.


Index: libcpp/line-map.c
--- libcpp/line-map.c (revision 191743)
+++ libcpp/line-map.c (working copy)
@@ -58,7 +58,7 @@  location_adhoc_data_hash (const void *l)
   const struct location_adhoc_data *lb =
       (const struct location_adhoc_data *) l;
-  return (hashval_t) lb->locus + (size_t) &lb->data;
+  return (hashval_t) lb->locus + (size_t) lb->data;

 /* Compare function for location_adhoc_data hashtable.  */