Commit 2b557972 by Jan Hubicka Committed by Jan Hubicka

re PR gcov-profile/20815 (-fprofile-use barfs with "coverage mismatch for…

re PR gcov-profile/20815 (-fprofile-use barfs with "coverage mismatch for function '...' while reading counter 'arcs'.")


	PR profile/20815
	* coverage.c (coverage_checksum_string): Fix code to stip random seeds
	from symbol names while computing checkup.

From-SVN: r106283
parent 0432a5de
2005-10-31 Jan Hubicka <jh@suse.cz> 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 PR profile/24487
* predict.c (predict_loops): Do not estimate more than * predict.c (predict_loops): Do not estimate more than
MAX_PRED_LOOP_ITERATIONS in PRED_LOOP_ITERATIONS heuristic. MAX_PRED_LOOP_ITERATIONS in PRED_LOOP_ITERATIONS heuristic.
......
...@@ -445,13 +445,23 @@ coverage_checksum_string (unsigned chksum, const char *string) ...@@ -445,13 +445,23 @@ coverage_checksum_string (unsigned chksum, const char *string)
as the checksums are used only for sanity checking. */ as the checksums are used only for sanity checking. */
for (i = 0; string[i]; i++) for (i = 0; string[i]; i++)
{ {
int offset = 0;
if (!strncmp (string + i, "_GLOBAL__N_", 11))
offset = 11;
if (!strncmp (string + i, "_GLOBAL__", 9)) if (!strncmp (string + i, "_GLOBAL__", 9))
for (i = i + 9; string[i]; i++) 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]=='_') if (string[i]=='_')
{ {
int y; int y;
unsigned seed;
int scan;
for (y = 1; y < 9; y++) for (y = 1; y < 9; y++)
if (!(string[i + y] >= '0' && string[i + y] <= '9') if (!(string[i + y] >= '0' && string[i + y] <= '9')
...@@ -465,14 +475,10 @@ coverage_checksum_string (unsigned chksum, const char *string) ...@@ -465,14 +475,10 @@ coverage_checksum_string (unsigned chksum, const char *string)
break; break;
if (y != 18) if (y != 18)
continue; continue;
scan = sscanf (string + i + 10, "%X", &seed); if (!dup)
gcc_assert (scan);
if (seed != crc32_string (0, flag_random_seed))
continue;
string = dup = xstrdup (string); string = dup = xstrdup (string);
for (y = 10; y < 18; y++) for (y = 10; y < 18; y++)
dup[i + y] = '0'; dup[i + y] = '0';
break;
} }
break; break;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment