Bug 14900 - [3.4 regression] ICE in loc_descriptor_from_tree (fix_trunc_expr)
Summary: [3.4 regression] ICE in loc_descriptor_from_tree (fix_trunc_expr)
Status: RESOLVED DUPLICATE of bug 14492
Alias: None
Product: gcc
Classification: Unclassified
Component: debug (show other bugs)
Version: 4.0.0
: P2 critical
Target Milestone: 3.4.2
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code, monitored
Depends on:
Blocks:
 
Reported: 2004-04-09 14:58 UTC by Andrew Pinski
Modified: 2004-10-30 21:10 UTC (History)
4 users (show)

See Also:
Host:
Target: anything that uses dwarf2
Build:
Known to work: 3.3.3 4.0.0
Known to fail: 3.4.0 3.4.1
Last reconfirmed: 2004-04-15 02:25:33


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Pinski 2004-04-09 14:58:44 UTC
Since fix_trunc_expr is not handled we get an ICE.
int main() {
  double d = 1.0;
  char x[(int) d];
  return 0;
}

Here is the tree which is aborting at this point:
<fix_trunc_expr 0x400da76c
    type <integer_type 0x400505e8 int asm_written SI
        size <integer_cst 0x4004e21c constant 32>
        unit size <integer_cst 0x4004e2a8 constant 4>
        align 32 symtab 1074991232 alias set -1 precision 32 min <integer_cst 0x4004e280 
-2147483648> max <integer_cst 0x4004e294 2147483647>
        pointer_to_this <pointer_type 0x4005c0d8>>

    arg 0 <var_decl 0x4012b0d8 d
        type <real_type 0x4005be58 double asm_written DF
            size <integer_cst 0x4004e5b4 constant 64>
            unit size <integer_cst 0x4004e938 constant 8>
            align 64 symtab 1074991488 alias set -1 precision 64
            pointer_to_this <pointer_type 0x4005c000>>
        used tree_1 tree_2 DF file pr14492.cc line 2 size <integer_cst 0x4004e5b4 64> unit size 
<integer_cst 0x4004e938 8>
        align 64 context <function_decl 0x40127d80 main> initial <real_cst 0x400cfde0 1.0e+0>
        (mem/i:DF (plus:SI (reg/f:SI 20 frame)
        (const_int -8 [0xfffffff8])) [0 d+0 S8 A64])
        chain <var_decl 0x4012b21c x type <array_type 0x4012b1b0>
            tree_1 BLK file pr14492.cc line 3
            size <mult_expr 0x4005d1f8 type <integer_type 0x4005ba20 bit_size_type>
                side-effects
                arg 0 <non_lvalue_expr 0x400da884 type <integer_type 0x4005ba20 bit_size_type>
                    side-effects readonly
                    arg 0 <nop_expr 0x400da834 type <integer_type 0x4005ba20 bit_size_type>
                        side-effects readonly
                        arg 0 <non_lvalue_expr 0x400da820 type <integer_type 0x4005b9b4 unsigned int>
                            side-effects readonly arg 0 <nop_expr 0x400da80c>>>>
                arg 1 <integer_cst 0x4004ea8c constant 8>>
            unit size <non_lvalue_expr 0x400da8d4 type <integer_type 0x4005b9b4 unsigned int>
                side-effects readonly
                arg 0 <nop_expr 0x400da8c0 type <integer_type 0x4005b9b4 unsigned int>
                    side-effects readonly
                    arg 0 <save_expr 0x4004c220 type <integer_type 0x4005baf8>
                        side-effects readonly asm_written used noplaceholder
                        arg 0 <nop_expr 0x400da7a8 type <integer_type 0x4005baf8>
                            arg 0 <fix_trunc_expr 0x400da76c>> arg 1 <function_decl 0x40127d80 main>
                        rtl 2 (reg:SI 0 ax [72])
>>>
            align 32 context <function_decl 0x40127d80 main>
            (mem/s:BLK (reg:SI 83) [0 x+0 A8])>>>
Comment 1 Volker Reichelt 2004-04-15 02:25:32 UTC
Confirmed.

The good news is that the bug is already fixed on mainline by
Richard Kenner's patch:

http://gcc.gnu.org/ml/gcc-cvs/2004-04/msg00406.html

Does a backport make sense?
Comment 2 Andrew Pinski 2004-04-23 19:43:57 UTC
More than just that kenner's patch fixed another regression dealing with VLA types so I 
should expect that kenner's patch be backported for both 3.3.4 and 3.4.1.
Comment 3 Mark Mitchell 2004-06-19 00:06:06 UTC
Postponed until GCC 3.4.2.

Kenner, would you please take the time to backport your patch to 3.4.2?
Comment 4 Andrew Pinski 2004-07-29 15:09:33 UTC
Broke
: Search converges between 2003-02-28-trunk (#195) and 2003-03-01-trunk (#196).

Fixed on the mainline
: Search converges between 2004-04-10-trunk (#448) and 2004-04-20-trunk (#449).
Comment 5 Volker Reichelt 2004-08-18 10:37:20 UTC
*** Bug 17076 has been marked as a duplicate of this bug. ***
Comment 6 Volker Reichelt 2004-08-18 10:38:29 UTC
Just for reference, here's the testcase from PR17076:

===========================
struct A
{
    int j;
};

void foo()
{
    int i[A().j];
}
===========================
Comment 7 Mark Mitchell 2004-08-19 20:47:54 UTC
Kenner, this is a second request that you backport your patch.
Comment 8 Richard Kenner 2004-08-19 21:00:35 UTC
Subject: Re:   [3.4 regression] ICE in loc_descriptor_from_tree (fix_trunc_expr)

That's a pretty big patch to fix a pretty pathalogical case.

I'd much prefer to just add a case for FIX_TRUNC_EXPR to
loc_descriptor_from_tree that returns 0.

That's a much safer approach for a release branch.
Comment 9 Mark Mitchell 2004-08-23 19:30:46 UTC
Kenner, thanks for the reply.  Would you be willing to prepare/test a patch that
does as you suggest, then?
Comment 10 Mark Mitchell 2004-08-24 02:21:32 UTC

*** This bug has been marked as a duplicate of 14492 ***
Comment 11 Richard Kenner 2004-08-24 05:37:59 UTC
Subject: Re:   [3.4 regression] ICE in loc_descriptor_from_tree (fix_trunc_expr)

    Kenner, thanks for the reply.  Would you be willing to prepare/test a
    patch that does as you suggest, then?

It's literally a two-line patch, but I'm not sure I have a testing environment
that works with the 3.4 branch.  I'm away this week and will check when
I get back.