summaryrefslogtreecommitdiff
path: root/patches/gcc/4.0.2/110-pr20815-fix.patch
blob: 7ac8ab509186c416a6c3e7cf1f7c75da8b95d2b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
Date: 18 May 2005 22:47:59 -0000
Message-ID: <20050518224759.7352.qmail@sourceware.org>
From: "hubicka at ucw dot cz" <gcc-bugzilla@gcc.gnu.org>
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_<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;
      }
  


-- 


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.