Date: 18 May 2005 22:47:59 -0000 Message-ID: <20050518224759.7352.qmail@sourceware.org> From: "hubicka at ucw dot cz" To: dank@kegel.com References: <20050407215701.20815.dank@kegel.com> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug gcov/profile/20815] -fprofile-use barfs with "coverage mismatch for function '...' while reading counter 'arcs'." ------- Additional Comments From hubicka at ucw dot cz 2005-05-18 22:47 ------- Subject: Re: [Bug gcov/profile/20815] -fprofile-use barfs with "coverage mismatch for function '...' while reading counter 'arcs'." > > ------- Additional Comments From hubicka at ucw dot cz 2005-05-18 22:22 ------- > Subject: Re: [Bug gcov/profile/20815] -fprofile-use barfs with "coverage mismatch for function '...' while reading counter 'arcs'." > > coverage_checksum_string already knows a bit about ignoring random seed > produced mess. It looks like this needs to be extended somehow to > handle namespaces too... This seems to solve the missmatch. Would it be possible to test it on bigger testcase and if it works distile a testcase that don't use file IO so it is more suitable for gcc regtesting? Index: coverage.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/coverage.c,v retrieving revision 1.6.2.12.2.12 diff -c -3 -p -r1.6.2.12.2.12 coverage.c *** gcc-old/gcc/coverage.c 18 May 2005 07:37:31 -0000 1.6.2.12.2.12 --- gcc/gcc/coverage.c 18 May 2005 22:45:36 -0000 *************** coverage_checksum_string (unsigned chksu *** 471,505 **** as the checksums are used only for sanity checking. */ for (i = 0; string[i]; i++) { 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; } --- 471,511 ---- 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)) ! offset = 9; ! ! /* C++ namespaces do have scheme: ! _GLOBAL__N___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; } -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20815 ------- You are receiving this mail because: ------- You reported the bug, or are watching the reporter.