gcc

Comment 1 for bug 623945

Revision history for this message
In , Lacombar (lacombar) wrote :

the following test-case:

#ifndef __GNUC_VA_LIST
#define __GNUC_VA_LIST
typedef __builtin_va_list __gnuc_va_list;
#endif

triggers the following ICE:

% /arm-none-linux-eabi/libexec/gcc/arm-none-linux-eabi/4.5.2/cc1 -v ./test-case.c -g -femit-struct-debug-baseonly -o ./test-case.o
ignoring nonexistent directory "/arm-none-linux-eabi/arm-none-linux-eabi//sys-root/x-tools/arm-none-linux-eabi/arm-none-linux-eabi//sys-root/include"
ignoring duplicate directory "/data/src/toolchain/build/x-tools/arm-none-linux-eabi/arm-none-linux-eabi//sys-root/usr/include"
#include "..." search starts here:
#include <...> search starts here:
 /arm-none-linux-eabi/lib/gcc/arm-none-linux-eabi/4.5.2/include
 /arm-none-linux-eabi/lib/gcc/arm-none-linux-eabi/4.5.2/include-fixed
 /arm-none-linux-eabi/lib/gcc/arm-none-linux-eabi/4.5.2/../../../../arm-none-linux-abi/include
End of search list.
In file included from ./test-case.c:1:0:
/arm-none-linux-eabi/lib/gcc/arm-none-linux-eabi/4.5.2/include/stdarg.h:40:1: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

The stack trace is the following:

Program received signal SIGSEGV, Segmentation fault.
0x08358433 in should_emit_struct_debug ()
Current language: auto; currently asm
#0 0x08358433 in should_emit_struct_debug ()
#1 0x08201a26 in gen_struct_or_union_type_die ()
#2 0x08202338 in gen_type_die_with_usage ()
#3 0x08202390 in gen_type_die ()
#4 0x081f3f0f in modified_type_die ()
#5 0x081fda5f in add_type_attribute ()
#6 0x08201ed4 in gen_typedef_die ()
#7 0x08202fe6 in gen_decl_die ()
#8 0x08203916 in dwarf2out_decl ()
#9 0x08203324 in dwarf2out_type_decl ()
#10 0x0835bd65 in rest_of_decl_compilation ()
#11 0x080d265c in finish_decl ()
#12 0x08133677 in c_parser_declaration_or_fndef ()
#13 0x08133153 in c_parser_external_declaration ()
#14 0x08132e08 in c_parser_translation_unit ()
#15 0x08141d23 in c_parse_file ()
#16 0x08126063 in c_common_parse_file ()
#17 0x08426ae9 in compile_file ()
#18 0x08428973 in do_compile ()
#19 0x08428a38 in toplev_main ()
#20 0x0814a172 in main ()

dump of should_emit_struct_debug():
0x08358410 <should_emit_struct_debug+101>: lea -0x1c(%ebp),%edx
0x08358413 <should_emit_struct_debug+104>: mov %eax,0x4(%esp)
0x08358417 <should_emit_struct_debug+108>: mov %edx,(%esp)
0x0835841a <should_emit_struct_debug+111>: call 0x8581c07 <expand_location>
0x0835841f <should_emit_struct_debug+116>: sub $0x4,%esp
0x08358422 <should_emit_struct_debug+119>: movzbl -0x10(%ebp),%eax
0x08358426 <should_emit_struct_debug+123>: test %al,%al
0x08358428 <should_emit_struct_debug+125>: je 0x8358430 <should_emit_struct_debug+133>
0x0835842a <should_emit_struct_debug+127>: movb $0x1,-0x31(%ebp)
0x0835842e <should_emit_struct_debug+131>: jmp 0x8358461 <should_emit_struct_debug+182>
0x08358430 <should_emit_struct_debug+133>: mov -0xc(%ebp),%eax
0x08358433 <should_emit_struct_debug+136>: mov 0x10(%eax),%eax
^^^ crash above ^^^
0x08358436 <should_emit_struct_debug+139>: lea -0x2c(%ebp),%edx
0x08358439 <should_emit_struct_debug+142>: mov %eax,0x4(%esp)
0x0835843d <should_emit_struct_debug+146>: mov %edx,(%esp)
0x08358440 <should_emit_struct_debug+149>: call 0x8581c07 <expand_location>
0x08358445 <should_emit_struct_debug+154>: sub $0x4,%esp
0x08358448 <should_emit_struct_debug+157>: mov -0x2c(%ebp),%eax
0x0835844b <should_emit_struct_debug+160>: mov %eax,(%esp)
0x0835844e <should_emit_struct_debug+163>: call 0x8358335 <matches_main_base>
0x08358453 <should_emit_struct_debug+168>: test %eax,%eax
0x08358455 <should_emit_struct_debug+170>: je 0x835845d <should_emit_struct_debug+178>
0x08358457 <should_emit_struct_debug+172>: movb $0x1,-0x31(%ebp)
0x0835845b <should_emit_struct_debug+176>: jmp 0x8358461 <should_emit_struct_debug+182>
0x0835845d <should_emit_struct_debug+178>: movb $0x0,-0x31(%ebp)
0x08358461 <should_emit_struct_debug+182>: movzbl -0x31(%ebp),%eax
0x08358465 <should_emit_struct_debug+186>: leave
0x08358466 <should_emit_struct_debug+187>: ret

and registers:
(gdb) info registers
eax 0x0 0
[...]

C source matching is left to the reader :)

In case that help, this compiler was build with the latest GMP/MPC/MPFR.

Compilers from the same code tree, but built for PowerPC or Sparc target, run fine.