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.
I'll have a look.
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.
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
Fixed.
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