gcc

ICE using va_list with -g -femit-struct-debug-baseonly

Bug #623945 reported by Arnd Bergmann
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Linaro GCC
Fix Released
Medium
Yao Qi
gcc
Confirmed
Medium

Bug Description

Doing test kernel builds with arm-linux-gnueabi-gcc (Ubuntu/Linaro 4.4.4-8ubuntu1hrw1) 4.4.5 20100728 (prerelease), I found that
I could not build with '-g -femit-struct-debug-baseonly', which resulted in an ICE when compiling stdarg.h or any other file containing '__builtin_va_list':

arnd@ocdc-kvm:/tmp$ echo 'typedef __builtin_va_list x;' > test.c
arnd@ocdc-kvm:/tmp$ arm-linux-gnueabi-gcc -g -femit-struct-debug-baseonly test.c -c
test.c:1: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.4/README.Bugs> for instructions.

Not sure if the bug requires __builtin_va_list, since I was not able to anything complex without including stdarg.h.

Tags: ice

Related branches

Revision history for this message
In , Lacombar (lacombar) wrote :
Download full text (4.5 KiB)

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),%ea...

Read more...

Revision history for this message
In , Mikpe (mikpe) wrote :

It also ICEs current gcc-4.4 and gcc-4.6.

Michael Hope (michaelh1)
tags: added: ice
Changed in gcc-linaro:
assignee: nobody → Yao Qi (yao-codesourcery)
Revision history for this message
In , Qiyao (qiyao) wrote :
Changed in gcc-linaro:
status: New → In Progress
Michael Hope (michaelh1)
Changed in gcc-linaro:
importance: Undecided → Medium
milestone: none → 4.4-2010.11-0
Revision history for this message
In , Qiyao (qiyao) wrote :

Author: qiyao
Date: Fri Oct 15 04:03:10 2010
New Revision: 165493

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=165493
Log:
gcc/

        PR target/45447
        * config/arm/arm.c (arm_build_builtin_va_list): Assign
        va_list_name to TYPE_STUB_DECL (va_list_type).

gcc/testsuite/

        PR target/45447
        * gcc.target/arm/pr45447.c: New test.

Added:
    trunk/gcc/testsuite/gcc.target/arm/pr45447.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/arm/arm.c
    trunk/gcc/testsuite/ChangeLog

Changed in gcc-linaro:
status: In Progress → Fix Committed
Revision history for this message
In , Kirill-shutemov (kirill-shutemov) wrote :

Any plans for branches?

Michael Hope (michaelh1)
Changed in gcc-linaro:
status: Fix Committed → Fix Released
Michael Hope (michaelh1)
Changed in gcc-linaro:
milestone: 4.4-2010.11-0 → 4.5-2010.11-0
Revision history for this message
In , Qiyao (qiyao) wrote :

Author: qiyao
Date: Mon Dec 27 12:32:44 2010
New Revision: 168269

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=168269
Log:
Backport from mainline:
gcc/
        PR target/45447
        * config/arm/arm.c (arm_build_builtin_va_list): Assign
        va_list_name to TYPE_STUB_DECL (va_list_type).

gcc/testsuite/
        PR target/45447
        * gcc.target/arm/pr45447.c: New test.

Added:
    branches/gcc-4_4-branch/gcc/testsuite/gcc.target/arm/pr45447.c
Modified:
    branches/gcc-4_4-branch/gcc/ChangeLog
    branches/gcc-4_4-branch/gcc/config/arm/arm.c
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog

Revision history for this message
In , Qiyao (qiyao) wrote :

Author: qiyao
Date: Mon Dec 27 12:45:02 2010
New Revision: 168270

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=168270
Log:
Backport from mainline:
gcc/
        PR target/45447
        * config/arm/arm.c (arm_build_builtin_va_list): Assign
        va_list_name to TYPE_STUB_DECL (va_list_type).

gcc/testsuite/
        PR target/45447
        * gcc.target/arm/pr45447.c: New test.

Added:
    branches/gcc-4_5-branch/gcc/testsuite/gcc.target/arm/pr45447.c
Modified:
    branches/gcc-4_5-branch/gcc/ChangeLog
    branches/gcc-4_5-branch/gcc/config/arm/arm.c
    branches/gcc-4_5-branch/gcc/testsuite/ChangeLog

Changed in gcc:
importance: Unknown → Medium
status: Unknown → Confirmed
Revision history for this message
In , Ramana-gcc (ramana-gcc) wrote :

Can this now be marked as being closed ?

Ramana

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.