Bug 43614 - [4.4 Regression] ice in gimple_rhs_has_side_effects, at gimple.c:2248
Summary: [4.4 Regression] ice in gimple_rhs_has_side_effects, at gimple.c:2248
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.5.0
: P3 normal
Target Milestone: 4.4.4
Assignee: Richard Biener
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2010-04-01 02:39 UTC by John Regehr
Modified: 2010-04-08 11:34 UTC (History)
2 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work: 4.3.4 4.5.0
Known to fail: 4.4.3
Last reconfirmed: 2010-04-01 14:22:08


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Regehr 2010-04-01 02:39:16 UTC
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)
Comment 1 Andrew Pinski 2010-04-01 03:07:50 UTC
# 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.
Comment 2 Andrew Pinski 2010-04-01 03:09:48 UTC
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];
Comment 3 Richard Biener 2010-04-01 14:21:56 UTC
Looks like a tuples issue in IVOPTs.  Mine.
Comment 4 Richard Biener 2010-04-01 14:35:43 UTC
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.
Comment 5 Richard Biener 2010-04-01 16:18:48 UTC
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

Comment 6 Richard Biener 2010-04-01 16:25:48 UTC
Fixed on trunk sofar.
Comment 7 Jakub Jelinek 2010-04-08 11:28:27 UTC
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

Comment 8 Jakub Jelinek 2010-04-08 11:34:24 UTC
Fixed.