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
This commit is contained in:
Jan Hubicka 2005-10-31 19:23:44 +01:00 committed by Jan Hubicka
parent 0432a5de96
commit 2b557972cf
2 changed files with 38 additions and 28 deletions

View 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.

View 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;
offset = 9;
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;
/* 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);