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

[Bug preprocessor/29966] New: crash in cc1 with backtrace from free()


Both gcc and g++ crash on this. (I'll attach the code later, as it's still
kind of large.) Seemingly innocent changes will affect the crash behavior.
Normally I compile with "-std=gnu99 -O2"; this is intended to be C code.
These very similar programs give different errors at times, especially when
using "-O0" instead of "-O2".

I suppose I'll blame the preprocessor, but changing from "-O2" to "-O0"
will usualy (not always) cause the crash to be a regular SIGSEGV instead
of a glibc backtrace. I suppose the preprocessor is all unified now though,
so a bit of memory corruption could make things go weird later.

$ gcc -std=gnu99 -O0 gcc-bug4.c
gcc-bug4.c: In function ?boomwrap?:
gcc-bug4.c:134: error: invalid application of ?sizeof? to incomplete type
?struct dief? 
gcc-bug4.c:138: error: expected ?:? before ?)? token
gcc-bug4.c:138: error: expected statement before ?)? token
gcc-bug4.c:138: error: expected expression before ?:? token
gcc-bug4.c:141: error: expected ?:? before ?)? token
gcc-bug4.c:141: error: expected statement before ?)? token
gcc-bug4.c:141: error: expected expression before ?:? token
gcc-bug4.c:141: error: expected ?:? before ?)? token
gcc-bug4.c:141: error: expected statement before ?)? token
gcc-bug4.c:141: error: expected expression before ?:? token
gcc-bug4.c:142: error: expected ?:? before ?)? token
gcc-bug4.c:142: error: expected statement before ?)? token
gcc-bug4.c:142: error: expected expression before ?:? token
gcc-bug4.c:447:1: error: unterminated argument list invoking macro "swap32"
gcc-bug4.c:142: error: ?swap32? undeclared (first use in this function)
gcc-bug4.c:142: error: (Each undeclared identifier is reported only once
gcc-bug4.c:142: error: for each function it appears in.)
gcc-bug4.c:142: error: expected ?;? at end of input
gcc-bug4.c:142: error: expected declaration or statement at end of input
*** glibc detected *** /usr/libexec/gcc/x86_64-redhat-linux/4.1.1/cc1: free():
invalid next size (normal): 0x0000000000c939e0 ***
======= Backtrace: =========
/lib64/libc.so.6[0x347e06eb00]
/lib64/libc.so.6(cfree+0x8c)[0x347e07227c]
/usr/libexec/gcc/x86_64-redhat-linux/4.1.1/cc1[0x696bfd]
/usr/libexec/gcc/x86_64-redhat-linux/4.1.1/cc1[0x746e53]
/usr/libexec/gcc/x86_64-redhat-linux/4.1.1/cc1[0x747224]
/usr/libexec/gcc/x86_64-redhat-linux/4.1.1/cc1[0x40af09]
/usr/libexec/gcc/x86_64-redhat-linux/4.1.1/cc1[0x4476ee]
/usr/libexec/gcc/x86_64-redhat-linux/4.1.1/cc1[0x44e164]
/usr/libexec/gcc/x86_64-redhat-linux/4.1.1/cc1[0x439aea]
/usr/libexec/gcc/x86_64-redhat-linux/4.1.1/cc1[0x6e9ac5]
/lib64/libc.so.6(__libc_start_main+0xf4)[0x347e01da44]
/usr/libexec/gcc/x86_64-redhat-linux/4.1.1/cc1(calloc+0x191)[0x402399]
======= Memory map: ========
00400000-00972000 r-xp 00000000 08:07 2734449                           
/usr/libexec/gcc/x86_64-redhat-linux/4.1.1/cc1
00b72000-00b79000 rw-p 00572000 08:07 2734449                           
/usr/libexec/gcc/x86_64-redhat-linux/4.1.1/cc1
00b79000-00c9a000 rw-p 00b79000 00:00 0                                  [heap]
347d000000-347d01a000 r-xp 00000000 08:07 1974387                       
/lib64/ld-2.4.90.so
347d219000-347d21a000 r--p 00019000 08:07 1974387                       
/lib64/ld-2.4.90.so
347d21a000-347d21b000 rw-p 0001a000 08:07 1974387                       
/lib64/ld-2.4.90.so
347e000000-347e144000 r-xp 00000000 08:07 1974396                       
/lib64/libc-2.4.90.so
347e144000-347e344000 ---p 00144000 08:07 1974396                       
/lib64/libc-2.4.90.so
347e344000-347e348000 r--p 00144000 08:07 1974396                       
/lib64/libc-2.4.90.so
347e348000-347e349000 rw-p 00148000 08:07 1974396                       
/lib64/libc-2.4.90.so
347e349000-347e34e000 rw-p 347e349000 00:00 0 
3489a00000-3489a0d000 r-xp 00000000 08:07 1974339                       
/lib64/libgcc_s-4.1.1-20060828.so.1
3489a0d000-3489c0c000 ---p 0000d000 08:07 1974339                       
/lib64/libgcc_s-4.1.1-20060828.so.1
3489c0c000-3489c0d000 rw-p 0000c000 08:07 1974339                       
/lib64/libgcc_s-4.1.1-20060828.so.1
2aaaaaaab000-2aaaaaaac000 rw-p 2aaaaaaab000 00:00 0 
2aaaaaac3000-2aaaaaac5000 rw-p 2aaaaaac3000 00:00 0 
2aaaaaac5000-2aaaadfb7000 r--p 00000000 08:07 833564                    
/usr/lib/locale/locale-archive
2aaaadfb7000-2aaaae484000 rw-p 2aaaadfb7000 00:00 0 
2aaab0000000-2aaab0021000 rw-p 2aaab0000000 00:00 0 
2aaab0021000-2aaab4000000 ---p 2aaab0021000 00:00 0 
7fffc45dc000-7fffc45f2000 rw-p 7fffc45dc000 00:00 0                     
[stack]
ffffffffff600000-ffffffffffe00000 ---p 00000000 00:00 0                  [vdso]
gcc-bug4.c:142: confused by earlier errors, bailing out


-- 
           Summary: crash in cc1 with backtrace from free()
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: acahalan at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29966


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