There was a big like this earlier but it's marked as resolved, so filing a new one. regehr@john-home:~/volatile/bugs/tmp296$ current-gcc -O small.c -c small.c: In function ‘main’: small.c:5:5: internal compiler error: in gimple_rhs_has_side_effects, at gimple.c:2248 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. regehr@john-home:~/volatile/bugs/tmp296$ cat small.c volatile int g_2[7]; void foo (unsigned); int main (void) { int i_459 = 0; int t2818; int t2819; volatile char *t2820; int t2821; volatile char *t2822; int *t2823; unsigned t2824; LL655: t2822 = (volatile char *)g_2; t2821 = i_459; t2820 = t2822 + t2821; t2823 = (int *)t2820; t2824 = *t2823; foo (t2824); t2818 = i_459; t2819 = t2818 + 1; i_459 = t2819; goto LL655; } regehr@john-home:~/volatile/bugs/tmp296$ current-gcc -v Using built-in specs. COLLECT_GCC=current-gcc COLLECT_LTO_WRAPPER=/home/regehr/z/compiler-install/gcc-r157896-install/libexec/gcc/i686-pc-linux-gnu/4.5.0/lto-wrapper Target: i686-pc-linux-gnu Configured with: ../configure --with-libelf=/usr/local --enable-lto --prefix=/home/regehr/z/compiler-install/gcc-r157896-install --program-prefix=r157896- --enable-languages=c,c++ Thread model: posix gcc version 4.5.0 20100331 (experimental) (GCC)
# VUSE <.MEM_13> D.1996_8 = MEM[symbol: g_2, index: D.2003_16]; We should not have any VOPs here as this statement is volatile.
But that is not a regression as 4.3.2 have: # VUSE <g_2_13> D.1207_8 = MEM[symbol: g_2, index: D.1220_19]; 4.1 is also broken: # VUSE <g_2_14>; D.1624_9 = MEM[symbol: g_2, base: D.1674_4];
Looks like a tuples issue in IVOPTs. Mine.
The issue is that build6 looks at TMR_SYMBOL to set TREE_SIDE_EFFECTS, but really TMRs volatileness or side-effectness depends on the original reference it was created from, not TMR_SYMBOL.
Subject: Bug 43614 Author: rguenth Date: Thu Apr 1 16:18:07 2010 New Revision: 157913 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=157913 Log: 2010-04-01 Richard Guenther <rguenther@suse.de> PR middle-end/43614 * tree-ssa-address.c (copy_mem_ref_info): Copy TREE_SIDE_EFFECTS and TREE_THIS_VOLATILE. (copy_ref_info): Likewise. * tree-ssa-operands.c (get_tmr_operands): Check TREE_THIS_VOLATILE. * tree.c (build6_stat): Ignore side-effects of all but arg5 for TARGET_MEM_REF. Set TREE_THIS_VOLATILE from arg5 of TARGET_MEM_REF. * gcc.c-torture/compile/pr43614.c: New testcase. Added: trunk/gcc/testsuite/gcc.c-torture/compile/pr43614.c Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-ssa-address.c trunk/gcc/tree-ssa-loop-ivopts.c trunk/gcc/tree-ssa-operands.c trunk/gcc/tree.c
Fixed on trunk sofar.
Subject: Bug 43614 Author: jakub Date: Thu Apr 8 11:28:06 2010 New Revision: 158117 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=158117 Log: Backport from mainline: 2010-04-01 Richard Guenther <rguenther@suse.de> PR middle-end/43614 * tree-ssa-address.c (copy_mem_ref_info): Copy TREE_SIDE_EFFECTS and TREE_THIS_VOLATILE. (copy_ref_info): Likewise. * tree-ssa-operands.c (get_tmr_operands): Check TREE_THIS_VOLATILE. * tree.c (build7_stat): Ignore side-effects of all but arg5 for TARGET_MEM_REF. Set TREE_THIS_VOLATILE from arg5 of TARGET_MEM_REF. * gcc.c-torture/compile/pr43614.c: New testcase. Added: branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr43614.c Modified: branches/gcc-4_4-branch/gcc/ChangeLog branches/gcc-4_4-branch/gcc/testsuite/ChangeLog branches/gcc-4_4-branch/gcc/tree-ssa-address.c branches/gcc-4_4-branch/gcc/tree-ssa-loop-ivopts.c branches/gcc-4_4-branch/gcc/tree-ssa-operands.c branches/gcc-4_4-branch/gcc/tree.c
Fixed.