Bug 28899 - [4.2 regression] gimplification failed
Summary: [4.2 regression] gimplification failed
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.2.0
: P3 blocker
Target Milestone: 4.0.4
Assignee: Jason Merrill
URL:
Keywords: ice-checking, ice-on-valid-code
Depends on: 27115
Blocks:
  Show dependency treegraph
 
Reported: 2006-08-30 11:26 UTC by Martin Michlmayr
Modified: 2006-09-01 18:00 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.0.3 4.1.1 4.0.4 4.1.2
Known to fail: 4.2.0
Last reconfirmed: 2006-09-01 14:51:21


Attachments
test case (950 bytes, text/plain)
2006-08-30 11:27 UTC, Martin Michlmayr
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Michlmayr 2006-08-30 11:26:48 UTC
The attached testcase produces an ICE "gimplification failed".  Works fine with gcc 4.1 and 4.2.0 20060819, but fails with 4.2 20060823 and 20060830.

gimplification failed:
{
  register unsigned int __v;
  register unsigned int __x;

  D.2493 = data + 4B;
  D.2494 = (const uint32_t *) D.2493;
  __x = *D.2494;
  length = __v;
} <bind_expr 0x2ad672cdd140
    type <void_type 0x2ad672b5d0b0 void VOID
        align 8 symtab 0 alias set -1
        pointer_to_this <pointer_type 0x2ad672b5d160>>
    side-effects tree_1
    vars <var_decl 0x2ad672cdb630 __v
        type <integer_type 0x2ad672b4b580 unsigned int sizes-gimplified public unsigned SI
            size <integer_cst 0x2ad672b38ba0 constant invariant 32>
            unit size <integer_cst 0x2ad672b386c0 constant invariant 4>
            align 32 symtab 0 alias set -1 precision 32 min <integer_cst 0x2ad672b38c90 0> max <integer_cst 0x2ad672b38c60 4294967295>>
        used tree_1 unsigned regdecl decl_5 SI file lcdf-typetools-otfcmap.cc line 92 size <integer_cst 0x2ad672b38ba0 32> unit size <integer_cst 0x2ad672b386c0 4>
        align 32 context <function_decl 0x2ad672cc88c0 check_table>
        chain <var_decl 0x2ad672cdb6e0 __x type <integer_type 0x2ad672b4b580 unsigned int>
            tree_1 tree_3 unsigned regdecl decl_5 SI file lcdf-typetools-otfcmap.cc line 92 size <integer_cst 0x2ad672b38ba0 32> unit size <integer_cst 0x2ad672b386c0 4>
            align 32 context <function_decl 0x2ad672cc88c0 check_table>>>
    body <statement_list 0x2ad672cd6ae0 type <void_type 0x2ad672b5d0b0 void>
        side-effects head 0x2ad672ce0d80 tail 0x2ad672cceca0 stmts 0x2ad672ce3e10 0x2ad672ce3e60 0x2ad672cdd0f0 0x2ad672cdd190

        stmt <modify_expr 0x2ad672ce3e10 type <pointer_type 0x2ad672cd3e70>
            side-effects arg 0 <var_decl 0x2ad672ce69a0 D.2493>
            arg 1 <plus_expr 0x2ad672cdd0a0 type <pointer_type 0x2ad672cd3e70>
                arg 0 <var_decl 0x2ad672cd3f20 data>
                arg 1 <integer_cst 0x2ad672cd2720 constant invariant 4>>
            lcdf-typetools-otfcmap.cc:94>
        stmt <modify_expr 0x2ad672ce3e60 type <pointer_type 0x2ad672cd5370>
            side-effects arg 0 <var_decl 0x2ad672ce6a50 D.2494>
            arg 1 <nop_expr 0x2ad672cdc840 type <pointer_type 0x2ad672cd5370>
                arg 0 <var_decl 0x2ad672ce69a0 D.2493>>
            lcdf-typetools-otfcmap.cc:94>
        stmt <modify_expr 0x2ad672cdd0f0 type <integer_type 0x2ad672b4b580 unsigned int>
            side-effects arg 0 <var_decl 0x2ad672cdb6e0 __x>
            arg 1 <indirect_ref 0x2ad672cdc880 type <integer_type 0x2ad672cd5420 unsigned int>
                readonly arg 0 <var_decl 0x2ad672ce6a50 D.2494>>
            lcdf-typetools-otfcmap.cc:94>
        stmt <modify_expr 0x2ad672cdd190 type <integer_type 0x2ad672cc94d0 uint32_t>
            side-effects arg 0 <var_decl 0x2ad672cd5a50 length> arg 1 <var_decl 0x2ad672cdb630 __v>
            lcdf-typetools-otfcmap.cc:89>>
    block <block 0x2ad672cde000 used vars <var_decl 0x2ad672cdb630 __v>
        supercontext <block 0x2ad672cde070 used
            supercontext <block 0x2ad672cde230 used vars <var_decl 0x2ad672cdb8f0 nGroups>
                supercontext <block 0x2ad672cde2a0 used vars <var_decl 0x2ad672cdb0b0 subh_key>
                    supercontext <block 0x2ad672cde310 used
                        supercontext <block 0x2ad672cde380 used vars <var_decl 0x2ad672cdb000 hi_byte> supercontext <block 0x2ad672cde3f0> subblocks <block 0x2ad672cde310>> subblocks <block 0x2ad672cde2a0>>
                    subblocks <block 0x2ad6727fad90 used vars <var_decl 0x2ad672cdb160 __v> supercontext <block 0x2ad672cde2a0> chain <block 0x2ad672cde230>>>
                subblocks <block 0x2ad6727faf50 used supercontext <block 0x2ad672cde230>
                    subblocks <block 0x2ad6727fae00 used vars <var_decl 0x2ad672cdb2c0 __v> supercontext <block 0x2ad6727faf50>
                        chain <block 0x2ad6727faee0 used vars <var_decl 0x2ad672cdb420 entryCount> supercontext <block 0x2ad6727faf50> subblocks <block 0x2ad6727fae70>>> chain <block 0x2ad672cde070>>> subblocks <block 0x2ad672cde000>
            chain <block 0x2ad672cde0e0 used vars <var_decl 0x2ad672cdb9a0 __v> supercontext <block 0x2ad672cde230>
                chain <block 0x2ad672cde1c0 used vars <var_decl 0x2ad672cdbb00 startCharCode> supercontext <block 0x2ad672cde230>
                    subblocks <block 0x2ad672cde150 used vars <var_decl 0x2ad672cdbbb0 __v> supercontext <block 0x2ad672cde1c0>>>>>>
    lcdf-typetools-otfcmap.cc:94>
lcdf-typetools-otfcmap.cc: In member function 'int Efont::OpenType::Cmap::check_table(int, ErrorHandler*) const':
lcdf-typetools-otfcmap.cc:89: internal compiler error: gimplification failed
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Comment 1 Martin Michlmayr 2006-08-30 11:27:15 UTC
Created attachment 12152 [details]
test case

Testcase from application "lcdf-typetools".
Comment 2 Andrew Pinski 2006-08-30 13:00:58 UTC
Confirmed, reduced testcase:
int check_table (int t)
{
  unsigned length = 0;
  if ((length =__extension__ ({register unsigned __v; __v;})))
    ;
}
Comment 3 Andrew Pinski 2006-08-31 03:10:32 UTC
I almost think it was caused by the patch which fixed PR 27115.
Martin, can you try a newer gcc 4.1.2 to double check that it is not a regression there also?
Comment 4 Martin Michlmayr 2006-08-31 09:55:28 UTC
(In reply to comment #3)
> I almost think it was caused by the patch which fixed PR 27115.
> Martin, can you try a newer gcc 4.1.2 to double check that it is not a
> regression there also?

No, 4.1.2 20060831 works.
Comment 5 Andrew Pinski 2006-09-01 05:46:36 UTC
Janis,
  Could you run a regression hunt on this bug?
Thanks,
Andrew
Comment 6 Andrew Pinski 2006-09-01 05:52:02 UTC
(In reply to comment #4)
> No, 4.1.2 20060831 works.
Well the ICE can only happen with checking turned on so it could still be a bug in 4.1.2.
Comment 7 Andrew Pinski 2006-09-01 06:11:36 UTC
Here is an even more reduced testcase:
void f(void)
{
  unsigned l, l1;
  l1 = l = ({unsigned __v; __v;});
}

Note the double use is required to ICE, otherwise we are ok.
There is no question about it after looking at the patch for PR 27115, that patch caused this ICE.  We used to create a temporary variable but now we don't.




(In reply to comment #6)
> Well the ICE can only happen with checking turned on so it could still be a 
> bug in 4.1.2.
Actually it cannot be as that patch was only applied to the mainline.
Comment 8 Jason Merrill 2006-09-01 17:59:49 UTC
Subject: Bug 28899

Author: jason
Date: Fri Sep  1 17:59:41 2006
New Revision: 116637

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116637
Log:
        PR c++/28899
        * gimplify.c (gimplify_modify_expr_rhs) [BIND_EXPR]: Handle
        want_value.

        * gimplify.c (voidify_wrapper_expr): Handle null type.

Added:
    trunk/gcc/testsuite/g++.dg/ext/stmtexpr9.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/gimplify.c

Comment 9 Jason Merrill 2006-09-01 18:00:35 UTC
fixed.