User account creation filtered due to spam.

Bug 28692 - [4.2 Regression] ICE in rtl_for_decl_init, at dwarf2out.c
Summary: [4.2 Regression] ICE in rtl_for_decl_init, at dwarf2out.c
Alias: None
Product: gcc
Classification: Unclassified
Component: debug (show other bugs)
Version: 4.2.0
: P1 blocker
Target Milestone: 4.2.0
Assignee: Geoff Keating
Keywords: ice-checking, ice-on-valid-code
Depends on:
Reported: 2006-08-11 07:58 UTC by Michael Cieslinski
Modified: 2006-08-22 19:17 UTC (History)
2 users (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed: 2006-08-21 22:08:14


Note You need to log in before you can comment on or make changes to this bug.
Description Michael Cieslinski 2006-08-11 07:58:27 UTC
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

    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)
Comment 1 Janis Johnson 2006-08-11 19:27:38 UTC
This problem also affects powerpc-linux, where a regression hunt identified the following patch:

    r112408 | geoffk | 2006-03-27 06:09:48 +0000 (Mon, 27 Mar 2006)
Comment 2 Andrew Pinski 2006-08-11 19:30:06 UTC
Comment 3 Geoff Keating 2006-08-20 23:21:25 UTC
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.
Comment 4 Andrew Pinski 2006-08-21 04:32:42 UTC
  Do you have a testcase where you get better debug info from your patch?

Andrew Pinski
Comment 5 Geoff Keating 2006-08-21 22:06:14 UTC
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?

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.

Comment 6 Geoff Keating 2006-08-22 01:20:00 UTC
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
Comment 7 Geoff Keating 2006-08-22 19:16:22 UTC
Subject: Bug 28692

Author: geoffk
Date: Tue Aug 22 19:16:03 2006
New Revision: 116331

Index: gcc/ChangeLog
2006-08-21  Geoffrey Keating  <>

	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  <>

	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.


Comment 8 Geoff Keating 2006-08-22 19:17:49 UTC
Patch above should have fixed this.