regehr@home:~/volatile/bugs/tmp346$ current-gcc -O2 -c small.c small.c: In function ‘func_115’: small.c:27:1: error: invalid first operand of MEM_REF &l_233[0] small.c:18:3: note: in statement # .MEM_6 = VDEF <.MEM_1(D)> MEM[(struct S0 *)&l_233[0]] = l_111$f4_5; small.c:27:1: internal compiler error: verify_stmts failed Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. regehr@home:~/volatile/bugs/tmp346$ current-gcc -v Using built-in specs. COLLECT_GCC=current-gcc COLLECT_LTO_WRAPPER=/mnt/z/z/compiler-install/gcc-r169046-install/libexec/gcc/i686-pc-linux-gnu/4.6.0/lto-wrapper Target: i686-pc-linux-gnu Configured with: ../configure --with-libelf=/usr/local --enable-lto --prefix=/mnt/z/z/compiler-install/gcc-r169046-install --program-prefix=r169046- --enable-languages=c,c++ Thread model: posix gcc version 4.6.0 20110120 (experimental) (GCC) regehr@home:~/volatile/bugs/tmp346$ cat small.c struct S0 { int f4; }; void func_23 (void) { int i; for (i = 0; i < 1;) ; } struct S0 func_105 (void) { struct S0 l_111 = { 99 }; return l_111; } void func_115 (void) { struct S0 l_233[1]; l_233[0] = func_105 (); func_105 (); func_23 (); }
Tiny bit reduced: struct S { int s; }; void foo (void) { for (;;) ; } struct S bar (void) { struct S s = { 99 }; return s; } void baz (void) { struct S s[1]; s[0] = bar (); bar (); foo (); } Only happens with -m32. My bet is this goes wrong during inlining. We have MEM[(struct S *)&<retval>] = s$s_5; stmt where &RESULT_DECL satisfies is_gimple_mem_ref_addr. But after inlining this becomes MEM[(struct S *)&s[0]] = s$s_5; and ADDR_EXPR of ARRAY_REF is not is_gimple_mem_ref_addr, so I suppose the inliner needs to fix this up somewhere.
Mine.
Author: rguenth Date: Thu Jan 20 14:42:20 2011 New Revision: 169055 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=169055 Log: 2011-01-20 Richard Guenther <rguenther@suse.de> PR middle-end/47370 * tree-inline.c (remap_gimple_op_r): Recurse manually for the pointer operand of MEM_REFs. * gcc.dg/torture/pr47370.c: New testcase. Added: trunk/gcc/testsuite/gcc.dg/torture/pr47370.c Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-inline.c
Fixed.