]> gcc.gnu.org Git - gcc.git/commitdiff
re PR gcov-profile/20815 (-fprofile-use barfs with "coverage mismatch for function...
authorJan Hubicka <jh@suse.cz>
Mon, 31 Oct 2005 18:23:44 +0000 (19:23 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Mon, 31 Oct 2005 18:23:44 +0000 (18:23 +0000)
PR profile/20815
* coverage.c (coverage_checksum_string): Fix code to stip random seeds
from symbol names while computing checkup.

From-SVN: r106283

gcc/ChangeLog
gcc/coverage.c

index aed015544e277d54c20394725d9ca119a3b38bca..b31e67c370c7a08857b087e4fe362a34c484398b 100644 (file)
@@ -1,5 +1,9 @@
 2005-10-31  Jan Hubicka  <jh@suse.cz>
 
+       PR profile/20815
+       * coverage.c (coverage_checksum_string): Fix code to stip random seeds
+       from symbol names while computing checkup.
+
        PR profile/24487
        * predict.c (predict_loops): Do not estimate more than
        MAX_PRED_LOOP_ITERATIONS in PRED_LOOP_ITERATIONS heuristic.
index a558e869addc2ca6920039eb079ab022f609096e..e3cd9abc55d987643c106657f71b6f3096c9663e 100644 (file)
@@ -445,36 +445,42 @@ coverage_checksum_string (unsigned chksum, const char *string)
      as the checksums are used only for sanity checking.  */
   for (i = 0; string[i]; i++)
     {
+      int offset = 0;
+      if (!strncmp (string + i, "_GLOBAL__N_", 11))
+      offset = 11;
       if (!strncmp (string + i, "_GLOBAL__", 9))
-       for (i = i + 9; string[i]; i++)
-         if (string[i]=='_')
-           {
-             int y;
-             unsigned seed;
-             int scan;
-
-             for (y = 1; y < 9; y++)
-               if (!(string[i + y] >= '0' && string[i + y] <= '9')
-                   && !(string[i + y] >= 'A' && string[i + y] <= 'F'))
-                 break;
-             if (y != 9 || string[i + 9] != '_')
-               continue;
-             for (y = 10; y < 18; y++)
-               if (!(string[i + y] >= '0' && string[i + y] <= '9')
-                   && !(string[i + y] >= 'A' && string[i + y] <= 'F'))
-                 break;
-             if (y != 18)
-               continue;
-             scan = sscanf (string + i + 10, "%X", &seed);
-             gcc_assert (scan);
-             if (seed != crc32_string (0, flag_random_seed))
-               continue;
-             string = dup = xstrdup (string);
-             for (y = 10; y < 18; y++)
-               dup[i + y] = '0';
-             break;
-           }
-      break;
+      offset = 9;
+
+      /* C++ namespaces do have scheme:
+         _GLOBAL__N_<filename>_<wrongmagicnumber>_<magicnumber>functionname
+       since filename might contain extra underscores there seems
+       to be no better chance then walk all possible offsets looking
+       for magicnuber.  */
+      if (offset)
+        for (;string[offset]; offset++)
+        for (i = i + offset; string[i]; i++)
+          if (string[i]=='_')
+            {
+              int y;
+
+              for (y = 1; y < 9; y++)
+                if (!(string[i + y] >= '0' && string[i + y] <= '9')
+                    && !(string[i + y] >= 'A' && string[i + y] <= 'F'))
+                  break;
+              if (y != 9 || string[i + 9] != '_')
+                continue;
+              for (y = 10; y < 18; y++)
+                if (!(string[i + y] >= '0' && string[i + y] <= '9')
+                    && !(string[i + y] >= 'A' && string[i + y] <= 'F'))
+                  break;
+              if (y != 18)
+                continue;
+              if (!dup)
+                string = dup = xstrdup (string);
+              for (y = 10; y < 18; y++)
+                dup[i + y] = '0';
+            }
+        break;
     }
 
   chksum = crc32_string (chksum, string);
This page took 0.071801 seconds and 5 git commands to generate.