This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/12931] New: ICE on valid code while parsing
- From: "tm at kloo dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Nov 2003 22:00:13 -0000
- Subject: [Bug c/12931] New: ICE on valid code while parsing
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12931
Summary: ICE on valid code while parsing
Product: gcc
Version: 3.4
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: tm at kloo dot net
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i386-linux
GCC host triplet: i386-linux
GCC target triplet: sh-elf
(gdb) file cc1
Reading symbols from cc1...done.
(gdb) set args -O2 -m4 quatern.i
(gdb) run
Starting program: /home/tm/gcc-build-sh-elf/gcc/cc1 -O2 -m4 quatern.i
quatern.i:480: warning: conflicting types for built-in function 'nan'
quatern.i:556: warning: conflicting types for built-in function 'nanf'
Program received signal SIGSEGV, Segmentation fault.
0x0807a535 in tagged_types_tu_compatible_p (t1=0x40201144, t2=0x4016cec4,
flags=0) at ../../gcc/gcc/c-typeck.c:680
680 t2 = DECL_ORIGINAL_TYPE (TYPE_NAME (t2));
(gdb) bt
#0 0x0807a535 in tagged_types_tu_compatible_p (t1=0x40201144, t2=0x4016cec4,
flags=0) at ../../gcc/gcc/c-typeck.c:680
#1 0x0807a25a in comptypes (type1=0x40201144, type2=0x4016cec4, flags=0) at
../../gcc/gcc/c-typeck.c:575
#2 0x0807aff4 in type_lists_compatible_p (args1=0x40202f64, args2=0x401760a0,
flags=0) at ../../gcc/gcc/c-typeck.c:902
#3 0x0807ae4b in function_types_compatible_p (f1=0x402043cc, f2=0x401a2360,
flags=0) at ../../gcc/gcc/c-typeck.c:861
#4 0x08079f87 in comptypes (type1=0x402043cc, type2=0x401a2360, flags=0) at
../../gcc/gcc/c-typeck.c:523
#5 0x08069544 in duplicate_decls (newdecl=0x40204438, olddecl=0x401a23cc,
different_binding_level=0, different_tu=0)
at ../../gcc/gcc/c-decl.c:809
#6 0x0806c23d in pushdecl (x=0x40204438) at ../../gcc/gcc/c-decl.c:1721
#7 0x0806deba in start_decl (declarator=0x401fe1f8, declspecs=0x40202e38,
initialized=0, attributes=0x0)
at ../../gcc/gcc/c-decl.c:2706
#8 0x0804c9d8 in yyparse () at c-parse.y:1332
#9 0x0804fc73 in c_parse_file () at c-parse.y:3033
#10 0x080a542c in c_common_parse_file (set_yydebug=0) at
../../gcc/gcc/c-opts.c:1227
#11 0x0826cb72 in compile_file () at ../../gcc/gcc/toplev.c:1836
#12 0x08270e43 in do_compile () at ../../gcc/gcc/toplev.c:4691
#13 0x08270eca in toplev_main (argc=4, argv=0xbffff934) at
../../gcc/gcc/toplev.c:4731
#14 0x4003ab5c in __libc_start_main (main=0x80bf530 <main>, argc=4,
ubp_av=0xbffff934, init=0x80493b4 <_init>,
fini=0x831b1b0 <_fini>, rtld_fini=0x4000d634 <_dl_fini>,
stack_end=0xbffff92c) at ../sysdeps/generic/libc-start.c:129
(gdb)
It looks like the second loop in tagged_types_tu_compatible_p:
static int
tagged_types_tu_compatible_p (tree t1, tree t2, int flags)
{
tree s1, s2;
bool needs_warning = false;
/* We have to verify that the tags of the types are the same. This
is harder than it looks because this may be a typedef, so we have
to go look at the original type. It may even be a typedef of a
typedef... */
while (TYPE_NAME (t1) && TREE_CODE (TYPE_NAME (t1)) == TYPE_DECL)
t1 = DECL_ORIGINAL_TYPE (TYPE_NAME (t1));
while (TYPE_NAME (t2) && TREE_CODE (TYPE_NAME (t2)) == TYPE_DECL)
t2 = DECL_ORIGINAL_TYPE (TYPE_NAME (t2));
...
winds up dereferencing a null pointer when trying to find the original type.
Toshi