Bug 54109 - [4.8 Regression] ICE at tree-ssa-structalias.c:3049 in get_constraint_for_component_ref
Summary: [4.8 Regression] ICE at tree-ssa-structalias.c:3049 in get_constraint_for_com...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.8.0
: P3 normal
Target Milestone: 4.8.0
Assignee: Richard Biener
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-27 23:04 UTC by Antoine Balestrat
Modified: 2012-10-09 23:34 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work: 4.7.0
Known to fail:
Last reconfirmed: 2012-07-28 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Antoine Balestrat 2012-07-27 23:04:31 UTC
Hello !
I was trying to compile the Linux 3.5 kernel with GCC 4.8.0 as of 20120725 (at -O{2,3}) when it ICEd on kernel/cpuset.c. Here is a reduced testcase that reproduces the issue :

$ cat cpuset.c

typedef struct
{
    unsigned long bits[4];
} nodemask_t;

struct cpuset
{
    long flags;
    nodemask_t mems_allowed;
    struct cpuset *parent;
} b;

void func1(unsigned long *p1, int p2)
{
    p1[p2 - 1] = 0;
}

void func2(nodemask_t *p1, int p2)
{
    func1(p1->bits, p2);
}

void func3(void)
{
    func2(&b.mems_allowed, 0);
}

$ xgcc -c cpuset.c -O2

cpuset.c: In function ‘func3’:
cpuset.c:26:1: internal compiler error: in get_constraint_for_component_ref, at tree-ssa-structalias.c:3049
 }
 ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

GCC 4.7.0 compiles it fine.
Comment 1 Richard Biener 2012-07-28 14:19:50 UTC
I'll have a look.
Comment 2 Richard Biener 2012-07-31 12:34:42 UTC
Inlining ends up generating

  MEM[(long unsigned int *)&b + 8B].bits[2305843009213693951]{lb: 0 sz: 8} = 0

which is of course bogus, but it's what the code does - referencing
b.mems_allowed.bits[-1].  It's the code that is still present in
tree-ssa-forwprop.c that out of

func2 (struct nodemask_t * p1, int p2)
{
...
  <bb 2>:
  D.1732_2 = &p1_1(D)->bits;
  D.1741_6 = (long unsigned int) p2_4(D);
  D.1740_7 = D.1741_6 * 8;
  D.1739_8 = D.1740_7 + 18446744073709551608;
  D.1738_9 = D.1732_2 + D.1739_8;
  *D.1738_9 = 0;

generates

  D.1741_6 = (long unsigned int) p2_4(D);
  D.1742_11 = D.1741_6 + 2305843009213693951;
  MEM[(long unsigned int *)p1_1(D)].bits[D.1742_11]{lb: 0 sz: 8} = 0;

we need to rip that out.
Comment 3 Richard Biener 2012-08-10 12:00:11 UTC
Author: rguenth
Date: Fri Aug 10 12:00:05 2012
New Revision: 190291

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=190291
Log:
2012-08-10  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/54109
	* tree-ssa-forwprop.c
	(forward_propagate_addr_into_variable_array_index): Remove.
	(forward_propagate_addr_expr_1): Adjust.

	* gcc.dg/torture/pr54109.c: New testcase.
	* gcc.dg/tree-ssa/forwprop-1.c: Adjust.
	* gcc.dg/tree-ssa/forwprop-2.c: Likewise.

Added:
    trunk/gcc/testsuite/gcc.dg/torture/pr54109.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/tree-ssa/forwprop-1.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/forwprop-2.c
    trunk/gcc/tree-ssa-forwprop.c
Comment 4 Richard Biener 2012-08-10 12:00:59 UTC
Fixed.
Comment 5 xur 2012-10-09 23:34:25 UTC
Author: xur
Date: Tue Oct  9 23:34:18 2012
New Revision: 192277

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=192277
Log:
2012-10-09  Rong Xu <xur@google.com>

	Google Ref: b/7049102.
	Backport r190291 from trunk.

	2012-08-10  Richard Guenther  <rguenther@suse.de>

		PR tree-optimization/54109
		* tree-ssa-forwprop.c
		(forward_propagate_addr_into_variable_array_index): Remove.
		(forward_propagate_addr_expr_1): Adjust.

		* gcc.dg/torture/pr54109.c: New testcase.
		* gcc.dg/tree-ssa/forwprop-1.c: Adjust.
		* gcc.dg/tree-ssa/forwprop-2.c: Likewise.

Added:
    branches/google/gcc-4_7/gcc/testsuite/gcc.dg/torture/pr54109.c
Modified:
    branches/google/gcc-4_7/gcc/ChangeLog.google-4_7
    branches/google/gcc-4_7/gcc/testsuite/gcc.dg/tree-ssa/forwprop-1.c
    branches/google/gcc-4_7/gcc/testsuite/gcc.dg/tree-ssa/forwprop-2.c
    branches/google/gcc-4_7/gcc/tree-ssa-forwprop.c