Bug 41123 - [4.4 Regression] ICE in expand_expr_real_1
Summary: [4.4 Regression] ICE in expand_expr_real_1
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.4.1
: P3 normal
Target Milestone: 4.4.2
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2009-08-19 17:32 UTC by Jakub Jelinek
Modified: 2009-08-19 22:55 UTC (History)
1 user (show)

See Also:
Host:
Target: i686-linux
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Jelinek 2009-08-19 17:32:02 UTC
typedef struct { int r, i; } F;

F
foo (float _Complex x)
{
  return *(F *) &x;
}

F
bar (float _Complex x)
{
  F f = foo (x);
  return f;
}

ICEs at -O2 -fno-strict-aliasing -m32 on x86_64-linux and i686-linux.
On the trunk this doesn't ICE likely due to expand on SSA.
Comment 1 Jakub Jelinek 2009-08-19 17:42:44 UTC
Since PR6177 that part of expand_expr* at least handles whole CONCAT, but as can be seen on this testcase, since VCE can be used, it should be probably handled fully.  On this testcase it could be handled just by giving one part of the CONCAT, but e.g. on:
typedef struct { char a, b, c, d, e, f, g, h; } F;

F
foo (float _Complex x)
{
  return *(F *) &x;
}

int
bar (float _Complex x)
{
  F f = foo (x);
  return f.b;
}

I'm afraid it just needs to store it into memory.
Comment 2 Jakub Jelinek 2009-08-19 22:51:36 UTC
Subject: Bug 41123

Author: jakub
Date: Wed Aug 19 22:51:20 2009
New Revision: 150946

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=150946
Log:
	PR middle-end/41123
	* expr.c (expand_expr_real_1) <normal_inner_ref>: Handle all kinds
	of CONCAT, not just bitpos 0 bitsize size of the whole CONCAT.

	* gcc.dg/pr41123.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/pr41123.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/expr.c
    trunk/gcc/testsuite/ChangeLog

Comment 3 Jakub Jelinek 2009-08-19 22:52:25 UTC
Subject: Bug 41123

Author: jakub
Date: Wed Aug 19 22:52:11 2009
New Revision: 150947

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=150947
Log:
	PR middle-end/41123
	* expr.c (expand_expr_real_1) <normal_inner_ref>: Handle all kinds
	of CONCAT, not just bitpos 0 bitsize size of the whole CONCAT.

	* gcc.dg/pr41123.c: New test.

Added:
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/pr41123.c
Modified:
    branches/gcc-4_4-branch/gcc/ChangeLog
    branches/gcc-4_4-branch/gcc/expr.c
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog

Comment 4 Jakub Jelinek 2009-08-19 22:55:15 UTC
Fixed.