When I compile the small program I get an ICE. By checking with older compiler versions I found this bug was introduced between gcc-4.2-20060325 and gcc-4.2-20060401. Michael Cieslinski dwarf2out_bug.c: typedef float FloatVect __attribute__((__vector_size__(16))); static FloatVect Foo = { 250000000.0, 0.0, 0.0, 0.0}; g++42v -g dwarf2out_bug.c dwarf2out_bug.c:1: internal compiler error: in rtl_for_decl_init, at dwarf2out.c:9959 Please submit a full bug report, with preprocessed source if appropriate. g++42v -v Using built-in specs. Target: x86_64-unknown-linux-gnu Configured with: ../gcc-4.2-20060729/configure --prefix=/usr/local/gcc42v --program-suffix=42v --with-arch=opteron --enable-languages=c,c++ --enable-__cxa_atexit --disable-nls --enable-threads=posix --disable-multilib --enable-checking Thread model: posix gcc version 4.2.0 20060729 (experimental)
This problem also affects powerpc-linux, where a regression hunt identified the following patch: http://gcc.gnu.org/viewcvs?view=rev&rev=112408 r112408 | geoffk | 2006-03-27 06:09:48 +0000 (Mon, 27 Mar 2006)
Confirmed.
As a workaround, I believe you can simply delete the gcc_assert. This will mean, though, that either you don't get debug information for Foo, or you will get debug information but saying that Foo lives in the constant pool.
Geoff, Do you have a testcase where you get better debug info from your patch? http://gcc.gnu.org/ml/gcc-patches/2006-03/msg01567.html Thanks, Andrew Pinski
Subject: Re: [4.2 Regression] ICE in rtl_for_decl_init, at dwarf2out.c On 20/08/2006, at 9:32 PM, pinskia at gcc dot gnu dot org wrote: > ------- Comment #4 from pinskia at gcc dot gnu dot org 2006-08-21 > 04:32 ------- > Geoff, > Do you have a testcase where you get better debug info from your > patch? > http://gcc.gnu.org/ml/gcc-patches/2006-03/msg01567.html It took me a while to find it, but here's an example: extern void x(); static void (*f)() = x; However, this patch is clearly not behaving the way I expected. I can reproduce the reported problem on powerpc-darwin when using 'gcc - O -gdwarf-2'. I'll work on a fix.
It turns out that if you compile this with 'gcc -mcpu=G4 -O -gdwarf-2' on powerpc-darwin, this testcase works fine, but if you do it with '-mcpu=G3', it fails; that is, it fails when V4SFmode is not supported by the target. The testcase does correctly generate a DW_AT_const_value: .byte 0x7 ; uleb128 0x7; (DIE (0xa0) DW_TAG_variable) .ascii "Foo\0" ; DW_AT_name .byte 0x1 ; DW_AT_decl_file .byte 0x2 ; DW_AT_decl_line .long 0x72 ; DW_AT_type .byte 0x10 ; DW_AT_const_value .long 0x4d6e6b28 ; fp or vector constant word 0 .long 0x0 ; fp or vector constant word 1 .long 0x0 ; fp or vector constant word 2 .long 0x0 ; fp or vector constant word 3
Subject: Bug 28692 Author: geoffk Date: Tue Aug 22 19:16:03 2006 New Revision: 116331 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116331 Log: Index: gcc/ChangeLog 2006-08-21 Geoffrey Keating <geoffk@apple.com> PR debug/28692 * dwarf2out.c (rtl_for_decl_init): Don't try to create RTL for complex values, nor for generic vector values. Index: gcc/testsuite/ChangeLog 2006-08-21 Geoffrey Keating <geoffk@apple.com> PR debug/28692 * gcc.dg/debug/const-1.c: New. * gcc.dg/debug/const-2.c: New. * gcc.dg/debug/dwarf2/const-1.c: New. * gcc.dg/debug/dwarf2/const-2.c: New. * gcc.dg/debug/dwarf2/const-2b.c: New. Added: trunk/gcc/testsuite/gcc.dg/debug/const-1.c trunk/gcc/testsuite/gcc.dg/debug/const-2.c trunk/gcc/testsuite/gcc.dg/debug/dwarf2/const-1.c trunk/gcc/testsuite/gcc.dg/debug/dwarf2/const-2.c trunk/gcc/testsuite/gcc.dg/debug/dwarf2/const-2b.c Modified: trunk/gcc/ChangeLog trunk/gcc/dwarf2out.c trunk/gcc/testsuite/ChangeLog
Patch above should have fixed this.