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]

problems w/ -traditional-cpp


Hi Neil...

I'm finally getting around to testing the new -traditional-cpp on
the NetBSD kernel .S files, and I've run into this:

CC=/usr/local/gnu/bin/x86_64-unknown-netbsd-gcc /usr/local/netbsd-tools/current/bin/nbmkdep  -x assembler-with-cpp -traditional-cpp -D_LOCORE  -Dx86_64 -I.  -I../../../../arch -I../../../.. -nostdinc  -DMAXUSERS=2 -D_KERNEL -D_KERNEL_OPT ../../../../arch/x86_64/x86_64/locore.S ../../../../arch/x86_64/x86_64/vector.S  ../../../../arch/x86_64/x86_64/copy.S ../../../../arch/x86_64/x86_64/microtime.S ../../../../arch/x86_64/x86_64/netbsd32_sigcode.S
x86_64-unknown-netbsd-gcc: Internal error: Segmentation fault (program cc1)
Please submit a full bug report.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
nbmkdep: compile failed.


yeah-baby:thorpej 36$ gdb ./cc1 /sys/arch/x86_64/compile/SIMICS/cc1.core
GNU gdb 5.0nb1
Copyright 2000 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386--netbsdelf"...
Core was generated by `cc1'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/libexec/ld.elf_so...done.
Loaded symbols for /usr/libexec/ld.elf_so
Reading symbols from /usr/lib/libintl.so.0...done.
Loaded symbols for /usr/lib/libintl.so.0
Reading symbols from /usr/lib/libc.so.12...done.
Loaded symbols for /usr/lib/libc.so.12
#0  0x808cd38 in paste_tokens (pfile=0x8412000, plhs=0xbfbfcf60, rhs=0x8415528)
    at ../../../gcc/gcc/cppmacro.c:392
392       end = cpp_spell_token (pfile, lhs, buf);
Breakpoint 1 at 0x80c3ccf: file ../../../gcc/gcc/diagnostic.c, line 1363.
Breakpoint 2 at 0x483682ad
Breakpoint 3 at 0x48368bc0
(gdb) print pfile
$1 = (cpp_reader *) 0x8412000
(gdb) print lhs  
$2 = (cpp_token *) 0x8415518
(gdb) print buf
$3 = (unsigned char *) 0x607187ac <Address 0x607187ac out of bounds>
(gdb) where
#0  0x808cd38 in paste_tokens (pfile=0x8412000, plhs=0xbfbfcf60, rhs=0x8415528)
    at ../../../gcc/gcc/cppmacro.c:392
#1  0x808ce1a in paste_all_tokens (pfile=0x8412000, lhs=0x8415518)
    at ../../../gcc/gcc/cppmacro.c:451
#2  0x808d812 in cpp_get_token (pfile=0x8412000)
    at ../../../gcc/gcc/cppmacro.c:1065
#3  0x808d8a9 in cpp_scan_nooutput (pfile=0x8412000)
    at ../../../gcc/gcc/cppmacro.c:1139
#4  0x8095874 in cpp_preprocess_file (pfile=0x8412000)
    at ../../../gcc/gcc/cppmain.c:111
#5  0x807ec11 in c_common_init (
    filename=0xbfbfd3bc "../../../../arch/x86_64/x86_64/microtime.S")
    at ../../../gcc/gcc/c-common.c:4545
#6  0x80878c4 in c_objc_common_init (
    filename=0xbfbfd3bc "../../../../arch/x86_64/x86_64/microtime.S")
    at ../../../gcc/gcc/c-objc-common.c:233
#7  0x8050db5 in c_init (
    filename=0xbfbfd3bc "../../../../arch/x86_64/x86_64/microtime.S")
    at ../../../gcc/gcc/c-lang.c:164
#8  0x82705c6 in lang_dependent_init (
    name=0xbfbfd3bc "../../../../arch/x86_64/x86_64/microtime.S")
    at ../../../gcc/gcc/toplev.c:5074
#9  0x82707ad in do_compile () at ../../../gcc/gcc/toplev.c:5184
#10 0x827081e in toplev_main (argc=19, argv=0xbfbfd174)
    at ../../../gcc/gcc/toplev.c:5217
#11 0x8097320 in main (argc=19, argv=0xbfbfd174) at ../../../gcc/gcc/main.c:35
#12 0x8049610 in ___start ()
(gdb) info registers
eax            0x5f4e4760       1598965600
ecx            0x844bf40        138723136
edx            0x8415528        138499368
ebx            0x8415518        138499352
esp            0x607187a8       0x607187a8
ebp            0xbfbfcf24       0xbfbfcf24
esi            0x607187ac       1618053036
edi            0x8412000        138485760
eip            0x808cd38        0x808cd38
eflags         0x10213  66067
cs             0x17     23
ss             0x1f     31
ds             0x1f     31
es             0x1f     31
fs             0x1f     31
gs             0x1f     31
fctrl          0x127f   4735
fstat          0x0      0
ftag           0xffff   65535
fiseg          0x0      0
fioff          0x0      0
foseg          0x0      0
fooff          0x0      0
fop            0x0      0
xmm0           0x00000000000000000000000000000000
xmm1           0x00000000000000000000000000000000
xmm2           0x00000000000000000000000000000000
xmm3           0x00000000000000000000000000000000
xmm4           0x00000000000000000000000000000000
xmm5           0x00000000000000000000000000000000
xmm6           0x00000000000000000000000000000000
xmm7           0x00000000000000000000000000000000
mxcsr          0x0      0
(gdb) print *buf
Cannot access memory at address 0x607187ac

Just trying to assemble the file yields:

/usr/local/gnu/bin/x86_64-unknown-netbsd-gcc  -x assembler-with-cpp -traditional-cpp -D_LOCORE  -Dx86_64 -I.  -I../../../../arch -I../../../.. -nostdinc  -DMAXUSERS=2 -D_KERNEL -D_KERNEL_OPT -c /u1/netbsd/src/sys/arch/x86_64/compile/SIMICS/../../../../arch/x86_64/x86_64/microtime.S
/var/tmp//cct8dQJG.s: Assembler messages:
/var/tmp//cct8dQJG.s:88: Warning: missing string
/var/tmp//cct8dQJG.s:88: Warning: rest of line ignored; first ignored character is `m'
/var/tmp//cct8dQJG.s:88: Warning: .stabs: missing comma
/var/tmp//cct8dQJG.s:88: Warning: rest of line ignored; first ignored character is `.'

This is because the output is incorrect.  Chunks of a header file are in
there which should not be, and the ENTRY() macro did not get expanded
properly.

If you want to tell me exactly which bits you want to try and debug this,
let me know, and I'd be happy to pack them up for you.

-- 
        -- Jason R. Thorpe <thorpej@wasabisystems.com>


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