patches/gcc/4.0.0/pr20815-fix.patch
changeset 1 eeea35fbf182
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/gcc/4.0.0/pr20815-fix.patch	Sat Feb 24 11:00:05 2007 +0000
     1.3 @@ -0,0 +1,121 @@
     1.4 +Date: 18 May 2005 22:47:59 -0000
     1.5 +Message-ID: <20050518224759.7352.qmail@sourceware.org>
     1.6 +From: "hubicka at ucw dot cz" <gcc-bugzilla@gcc.gnu.org>
     1.7 +To: dank@kegel.com
     1.8 +References: <20050407215701.20815.dank@kegel.com>
     1.9 +Reply-To: gcc-bugzilla@gcc.gnu.org
    1.10 +Subject: [Bug gcov/profile/20815] -fprofile-use barfs with "coverage mismatch for function '...' while reading counter 'arcs'."
    1.11 +
    1.12 +
    1.13 +------- Additional Comments From hubicka at ucw dot cz  2005-05-18 22:47 -------
    1.14 +Subject: Re: [Bug gcov/profile/20815] -fprofile-use barfs with "coverage mismatch for function '...' while reading counter 'arcs'."
    1.15 +
    1.16 +> 
    1.17 +> ------- Additional Comments From hubicka at ucw dot cz  2005-05-18 22:22 -------
    1.18 +> Subject: Re: [Bug gcov/profile/20815] -fprofile-use barfs with "coverage mismatch for function '...' while reading counter 'arcs'."
    1.19 +> 
    1.20 +> coverage_checksum_string already knows a bit about ignoring random seed
    1.21 +> produced mess.  It looks like this needs to be extended somehow to
    1.22 +> handle namespaces too...
    1.23 +
    1.24 +This seems to solve the missmatch.  Would it be possible to test it on
    1.25 +bigger testcase and if it works distile a testcase that don't use
    1.26 +file IO so it is more suitable for gcc regtesting?
    1.27 +
    1.28 +Index: coverage.c
    1.29 +===================================================================
    1.30 +RCS file: /cvs/gcc/gcc/gcc/coverage.c,v
    1.31 +retrieving revision 1.6.2.12.2.12
    1.32 +diff -c -3 -p -r1.6.2.12.2.12 coverage.c
    1.33 +*** gcc-old/gcc/coverage.c	18 May 2005 07:37:31 -0000	1.6.2.12.2.12
    1.34 +--- gcc/gcc/coverage.c	18 May 2005 22:45:36 -0000
    1.35 +*************** coverage_checksum_string (unsigned chksu
    1.36 +*** 471,505 ****
    1.37 +       as the checksums are used only for sanity checking.  */
    1.38 +    for (i = 0; string[i]; i++)
    1.39 +      {
    1.40 +        if (!strncmp (string + i, "_GLOBAL__", 9))
    1.41 +! 	for (i = i + 9; string[i]; i++)
    1.42 +! 	  if (string[i]=='_')
    1.43 +! 	    {
    1.44 +! 	      int y;
    1.45 +! 	      unsigned seed;
    1.46 +! 	      int scan;
    1.47 +! 
    1.48 +! 	      for (y = 1; y < 9; y++)
    1.49 +! 		if (!(string[i + y] >= '0' && string[i + y] <= '9')
    1.50 +! 		    && !(string[i + y] >= 'A' && string[i + y] <= 'F'))
    1.51 +! 		  break;
    1.52 +! 	      if (y != 9 || string[i + 9] != '_')
    1.53 +! 		continue;
    1.54 +! 	      for (y = 10; y < 18; y++)
    1.55 +! 		if (!(string[i + y] >= '0' && string[i + y] <= '9')
    1.56 +! 		    && !(string[i + y] >= 'A' && string[i + y] <= 'F'))
    1.57 +! 		  break;
    1.58 +! 	      if (y != 18)
    1.59 +! 		continue;
    1.60 +! 	      scan = sscanf (string + i + 10, "%X", &seed);
    1.61 +! 	      gcc_assert (scan);
    1.62 +! 	      if (seed != crc32_string (0, flag_random_seed))
    1.63 +! 		continue;
    1.64 +! 	      string = dup = xstrdup (string);
    1.65 +! 	      for (y = 10; y < 18; y++)
    1.66 +! 		dup[i + y] = '0';
    1.67 +! 	      break;
    1.68 +! 	    }
    1.69 +        break;
    1.70 +      }
    1.71 +  
    1.72 +--- 471,511 ----
    1.73 +       as the checksums are used only for sanity checking.  */
    1.74 +    for (i = 0; string[i]; i++)
    1.75 +      {
    1.76 ++       int offset = 0;
    1.77 ++       if (!strncmp (string + i, "_GLOBAL__N_", 11))
    1.78 ++ 	offset = 11;
    1.79 +        if (!strncmp (string + i, "_GLOBAL__", 9))
    1.80 +! 	offset = 9;
    1.81 +! 
    1.82 +!       /* C++ namespaces do have scheme:
    1.83 +!          _GLOBAL__N_<filename>_<wrongmagicnumber>_<magicnumber>functionname
    1.84 +! 	 since filename might contain extra underscores there seems
    1.85 +! 	 to be no better chance then walk all possible offsets looking
    1.86 +! 	 for magicnuber.  */
    1.87 +!       if (offset)
    1.88 +!         for (;string[offset]; offset++)
    1.89 +! 	  for (i = i + offset; string[i]; i++)
    1.90 +! 	    if (string[i]=='_')
    1.91 +! 	      {
    1.92 +! 		int y;
    1.93 +! 
    1.94 +! 		for (y = 1; y < 9; y++)
    1.95 +! 		  if (!(string[i + y] >= '0' && string[i + y] <= '9')
    1.96 +! 		      && !(string[i + y] >= 'A' && string[i + y] <= 'F'))
    1.97 +! 		    break;
    1.98 +! 		if (y != 9 || string[i + 9] != '_')
    1.99 +! 		  continue;
   1.100 +! 		for (y = 10; y < 18; y++)
   1.101 +! 		  if (!(string[i + y] >= '0' && string[i + y] <= '9')
   1.102 +! 		      && !(string[i + y] >= 'A' && string[i + y] <= 'F'))
   1.103 +! 		    break;
   1.104 +! 		if (y != 18)
   1.105 +! 		  continue;
   1.106 +! 		if (!dup)
   1.107 +! 		  string = dup = xstrdup (string);
   1.108 +! 		for (y = 10; y < 18; y++)
   1.109 +! 		  dup[i + y] = '0';
   1.110 +! 	      }
   1.111 +        break;
   1.112 +      }
   1.113 +  
   1.114 +
   1.115 +
   1.116 +-- 
   1.117 +
   1.118 +
   1.119 +http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20815
   1.120 +
   1.121 +------- You are receiving this mail because: -------
   1.122 +You reported the bug, or are watching the reporter.
   1.123 +
   1.124 +