This is the mail archive of the gcc@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]

Stange gcc 3.3 bug


I have a very strange gcc 3.3 bug on Linux/ia64. At random, I got
bootstrap failure:

Bootstrap comparison failure!
java/decl.o differs
make[3]: *** [compare] Error 1
make[3]: Leaving directory
`/export/build/gnu/gcc-3.3-redhat/build-ia64-linux/gcc'
make[2]: *** [bootstrap] Error 2
make[2]: Leaving directory `/export/build/gnu/gcc-3.3-redhat/build-ia64-linux'

When I ran stage2/xgcc at command-line, java/decl.o was OK. I got it
from time to time on 2 different machines with different kernels. When
it happened, I always got the same difference:

-java/decl.o:     file format elf64-ia64-little
+stage2/java/decl.o:     file format elf64-ia64-little

 Disassembly of section .text:

@@ -2054,10 +2054,10 @@ Disassembly of section .text:
     2a50:      0b 70 00 1e 18 10       [MMI]       ld8 r14=[r15];;
     2a56:      70 00 38 0c 72 00                   cmp.eq p7,p6=0,r14
     2a5c:      00 00 04 00                         nop.i 0x0;;
-    2a60:      dc 00 20 40 98 11       [MFB] (p06) st8 [r32]=r8
+    2a60:      fc 00 20 1e 98 11       [MFB] (p07) st8 [r15]=r8
     2a66:      00 00 00 02 00 00                   nop.f 0x0
     2a6c:      00 00 00 20                         nop.b 0x0
-    2a70:      e0 00 20 1e 98 11       [MII] (p07) st8 [r15]=r8
+    2a70:      c0 00 20 40 98 11       [MII] (p06) st8 [r32]=r8
     2a76:      f0 c0 22 00 42 00                   adds r15=88,r8
     2a7c:      04 40 00 84                         mov r32=r8
     2a80:      0a 70 00 46 18 10       [MMI]       ld8 r14=[r35];;

java/decl.o is "incorrect" one and stage2/java/decl.o is correct one.
Although java/decl.o is different, the functionality is the same as
stage2/java/decl.o. I ran valgrind on the cross compiler. I got

==12636== Invalid read of size 1
==12636==    at 0x807DC78: handle_newline (cpplex.c:116)
==12636==    by 0x807EC94: _cpp_lex_direct (cpplex.c:990)
==12636==    by 0x807EAF8: _cpp_lex_token (cpplex.c:848)
==12636==    by 0x807C069: read_flag (cpplib.c:726)
==12636==    Address 0x40F8381D is not stack'd, malloc'd or free'd
==12636==
==12636== Invalid read of size 1
==12636==    at 0x807EC22: _cpp_lex_direct (cpplex.c:971)
==12636==    by 0x807EAF8: _cpp_lex_token (cpplex.c:848)
==12636==    by 0x8081AF7: cpp_get_token (cppmacro.c:1121)
==12636==    by 0x8052D9C: c_lex (c-lex.c:677)
==12636==    Address 0x40F8381D is not stack'd, malloc'd or free'd
==12636==
==12636== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)

I am running this patch, with which I bootstrapped gcc 3.3 on 2
Linux/ia64 machines. I will keep bootstrapping gcc 3.3 on those 2
machines.


H.J.
---
--- gcc/cpplex.c.leak	2003-06-11 13:31:16.000000000 -0700
+++ gcc/cpplex.c	2003-07-01 17:26:25.000000000 -0700
@@ -113,7 +113,8 @@ handle_newline (pfile)
 
   /* Handle CR-LF and LF-CR.  Most other implementations (e.g. java)
      only accept CR-LF; maybe we should fall back to that behavior?  */
-  if (buffer->cur[-1] + buffer->cur[0] == '\r' + '\n')
+  if (buffer->cur != buffer->rlimit
+      && (buffer->cur[-1] + buffer->cur[0]) == '\r' + '\n')
     buffer->cur++;
 
   buffer->line_base = buffer->cur;
@@ -968,7 +969,13 @@ _cpp_lex_direct (pfile)
   result->line = pfile->line;
 
  skipped_white:
-  c = *buffer->cur++;
+  if (buffer->cur == buffer->rlimit)
+    {
+      c = '\0';
+      buffer->cur++;
+    }
+  else
+    c = *buffer->cur++;
   result->col = CPP_BUF_COLUMN (buffer, buffer->cur);
 
  trigraph:


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