patches/gcc/4.0.0/120-pr20815-fix.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Fri Sep 04 17:27:16 2009 +0200 (2009-09-04)
changeset 1512 439a6b292917
permissions -rw-r--r--
TODO: update

Add TODO list for m4, autoconf, automake and libtool.
Building our own versions would remove burden from the users
who have older versions on their distributions, and are not
ready/able/allowed to upgrade.
     1 Date: 18 May 2005 22:47:59 -0000
     2 Message-ID: <20050518224759.7352.qmail@sourceware.org>
     3 From: "hubicka at ucw dot cz" <gcc-bugzilla@gcc.gnu.org>
     4 To: dank@kegel.com
     5 References: <20050407215701.20815.dank@kegel.com>
     6 Reply-To: gcc-bugzilla@gcc.gnu.org
     7 Subject: [Bug gcov/profile/20815] -fprofile-use barfs with "coverage mismatch for function '...' while reading counter 'arcs'."
     8 
     9 
    10 ------- Additional Comments From hubicka at ucw dot cz  2005-05-18 22:47 -------
    11 Subject: Re: [Bug gcov/profile/20815] -fprofile-use barfs with "coverage mismatch for function '...' while reading counter 'arcs'."
    12 
    13 > 
    14 > ------- Additional Comments From hubicka at ucw dot cz  2005-05-18 22:22 -------
    15 > Subject: Re: [Bug gcov/profile/20815] -fprofile-use barfs with "coverage mismatch for function '...' while reading counter 'arcs'."
    16 > 
    17 > coverage_checksum_string already knows a bit about ignoring random seed
    18 > produced mess.  It looks like this needs to be extended somehow to
    19 > handle namespaces too...
    20 
    21 This seems to solve the missmatch.  Would it be possible to test it on
    22 bigger testcase and if it works distile a testcase that don't use
    23 file IO so it is more suitable for gcc regtesting?
    24 
    25 Index: coverage.c
    26 ===================================================================
    27 RCS file: /cvs/gcc/gcc/gcc/coverage.c,v
    28 retrieving revision 1.6.2.12.2.12
    29 diff -c -3 -p -r1.6.2.12.2.12 coverage.c
    30 *** gcc-old/gcc/coverage.c	18 May 2005 07:37:31 -0000	1.6.2.12.2.12
    31 --- gcc/gcc/coverage.c	18 May 2005 22:45:36 -0000
    32 *************** coverage_checksum_string (unsigned chksu
    33 *** 471,505 ****
    34        as the checksums are used only for sanity checking.  */
    35     for (i = 0; string[i]; i++)
    36       {
    37         if (!strncmp (string + i, "_GLOBAL__", 9))
    38 ! 	for (i = i + 9; string[i]; i++)
    39 ! 	  if (string[i]=='_')
    40 ! 	    {
    41 ! 	      int y;
    42 ! 	      unsigned seed;
    43 ! 	      int scan;
    44 ! 
    45 ! 	      for (y = 1; y < 9; y++)
    46 ! 		if (!(string[i + y] >= '0' && string[i + y] <= '9')
    47 ! 		    && !(string[i + y] >= 'A' && string[i + y] <= 'F'))
    48 ! 		  break;
    49 ! 	      if (y != 9 || string[i + 9] != '_')
    50 ! 		continue;
    51 ! 	      for (y = 10; y < 18; y++)
    52 ! 		if (!(string[i + y] >= '0' && string[i + y] <= '9')
    53 ! 		    && !(string[i + y] >= 'A' && string[i + y] <= 'F'))
    54 ! 		  break;
    55 ! 	      if (y != 18)
    56 ! 		continue;
    57 ! 	      scan = sscanf (string + i + 10, "%X", &seed);
    58 ! 	      gcc_assert (scan);
    59 ! 	      if (seed != crc32_string (0, flag_random_seed))
    60 ! 		continue;
    61 ! 	      string = dup = xstrdup (string);
    62 ! 	      for (y = 10; y < 18; y++)
    63 ! 		dup[i + y] = '0';
    64 ! 	      break;
    65 ! 	    }
    66         break;
    67       }
    68   
    69 --- 471,511 ----
    70        as the checksums are used only for sanity checking.  */
    71     for (i = 0; string[i]; i++)
    72       {
    73 +       int offset = 0;
    74 +       if (!strncmp (string + i, "_GLOBAL__N_", 11))
    75 + 	offset = 11;
    76         if (!strncmp (string + i, "_GLOBAL__", 9))
    77 ! 	offset = 9;
    78 ! 
    79 !       /* C++ namespaces do have scheme:
    80 !          _GLOBAL__N_<filename>_<wrongmagicnumber>_<magicnumber>functionname
    81 ! 	 since filename might contain extra underscores there seems
    82 ! 	 to be no better chance then walk all possible offsets looking
    83 ! 	 for magicnuber.  */
    84 !       if (offset)
    85 !         for (;string[offset]; offset++)
    86 ! 	  for (i = i + offset; string[i]; i++)
    87 ! 	    if (string[i]=='_')
    88 ! 	      {
    89 ! 		int y;
    90 ! 
    91 ! 		for (y = 1; y < 9; y++)
    92 ! 		  if (!(string[i + y] >= '0' && string[i + y] <= '9')
    93 ! 		      && !(string[i + y] >= 'A' && string[i + y] <= 'F'))
    94 ! 		    break;
    95 ! 		if (y != 9 || string[i + 9] != '_')
    96 ! 		  continue;
    97 ! 		for (y = 10; y < 18; y++)
    98 ! 		  if (!(string[i + y] >= '0' && string[i + y] <= '9')
    99 ! 		      && !(string[i + y] >= 'A' && string[i + y] <= 'F'))
   100 ! 		    break;
   101 ! 		if (y != 18)
   102 ! 		  continue;
   103 ! 		if (!dup)
   104 ! 		  string = dup = xstrdup (string);
   105 ! 		for (y = 10; y < 18; y++)
   106 ! 		  dup[i + y] = '0';
   107 ! 	      }
   108         break;
   109       }
   110   
   111 
   112 
   113 -- 
   114 
   115 
   116 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20815
   117 
   118 ------- You are receiving this mail because: -------
   119 You reported the bug, or are watching the reporter.
   120 
   121