This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PR profile/28015 (invalid checksum wrt random seed)


Hi,
I've found the original testcase and verified that the new patch makes
it happy as well.  Here is full patch I comitted after x86-64 testing.

Index: ChangeLog
===================================================================
*** ChangeLog	(revision 112732)
--- ChangeLog	(working copy)
***************
*** 1,3 ****
--- 1,10 ----
+ 2006-04-06  Jan Hubicka  <jh@suse.cz>
+ 
+ 	PR profile/20815
+ 	PR profile/26399
+ 	* coverage.c (coverage_checksum_string): Reorganize loop to not read
+ 	after buffer.
+ 
  2006-04-05  DJ Delorie  <dj@redhat.com>
  
  	* config/m32c/m32c.h (INCOMING_FRAME_SP_OFFSET): Adjust for m16c
Index: testsuite/ChangeLog
===================================================================
*** testsuite/ChangeLog	(revision 112732)
--- testsuite/ChangeLog	(working copy)
***************
*** 1,3 ****
--- 1,8 ----
+ 2006-04-06  Jan Hubicka  <jh@suse.cz>
+ 
+ 	PR profile/26399
+ 	* g++.dg/bprob/g++-bprob-2.C: New testcase.
+ 
  2006-04-05  Roger Sayle  <roger@eyesopen.com>
  
  	* gfortran.dg/dependency_18.f90: New test case.
Index: testsuite/g++.dg/bprob/g++-bprob-2.C
===================================================================
*** testsuite/g++.dg/bprob/g++-bprob-2.C	(revision 0)
--- testsuite/g++.dg/bprob/g++-bprob-2.C	(revision 0)
***************
*** 0 ****
--- 1,15 ----
+ namespace {
+ 
+ int calc(int j)
+ {
+   if (j==0) return 0;
+   return calc(j-1)*j % 17;
+ }
+ 
+ }
+ 
+ int main(void)
+ {
+   return calc(25);
+ }
+ 
Index: coverage.c
===================================================================
*** coverage.c	(revision 112732)
--- coverage.c	(working copy)
*************** coverage_checksum_string (unsigned chksu
*** 457,486 ****
         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);
--- 457,487 ----
         to be no better chance then walk all possible offsets looking
         for magicnuber.  */
        if (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);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]