Bug 43679

Summary: [4.5/4.6 Regression] ice in gen_lsm_tmp_name, at tree-ssa-loop-im.c:1812
Product: gcc Reporter: John Regehr <regehr>
Component: tree-optimizationAssignee: Richard Biener <rguenth>
Status: RESOLVED FIXED    
Severity: normal CC: chenyang, gcc-bugs, rguenth
Priority: P3 Keywords: ice-on-valid-code
Version: unknown   
Target Milestone: 4.5.0   
Host: x86_64-unknown-linux-gnu Target: x86_64-unknown-linux-gnu
Build: x86_64-unknown-linux-gnu Known to work:
Known to fail: Last reconfirmed: 2010-04-08 08:14:03

Description John Regehr 2010-04-07 20:29:54 UTC
[regehr@gamow tmp400]$ current-gcc -c -O2 small.c
small.c: In function 'func_37':
small.c:11:6: internal compiler error: in gen_lsm_tmp_name, at tree-ssa-loop-im.c:1812
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

[regehr@gamow tmp400]$ cat small.c

unsigned g_5;
int g_7;
int g_23[2];
int *g_29 = &g_23[0];
int **g_59;
unsigned long g_186;

int foo (int, int);
int bar (int);

void func_37 (long p_38)
{
  int *l_39 = &g_7;
  *l_39 = (*l_39
	     ||
	     (foo
	      (((*g_29 != *l_39, ((bar (g_59 != &l_39), 0), 0))),
	       0)));
  foo (*l_39, 0);
  int **l_256 = &l_39;
  {
    for (0; g_186; 0)
      {
	*l_256 = *l_256;
	if (g_5)
	  goto lbl_270;
	*l_39 &= 0;
      }
  }
lbl_270:
  ;
}

[regehr@gamow tmp400]$ current-gcc -v

Using built-in specs.
COLLECT_GCC=current-gcc
COLLECT_LTO_WRAPPER=/uusoc/exports/scratch/regehr/z/compiler-install/gcc-r158079-install/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.6.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --with-libelf=/usr/local --enable-lto --prefix=/home/regehr/z/compiler-install/gcc-r158079-install --program-prefix=r158079- --enable-languages=c,c++
Thread model: posix
gcc version 4.6.0 20100407 (experimental) (GCC)
Comment 1 H.J. Lu 2010-04-07 22:04:29 UTC
It is caused by revision 148718:

http://gcc.gnu.org/ml/gcc-cvs/2009-06/msg00701.html
Comment 2 Richard Biener 2010-04-08 08:14:02 UTC
Mine then.
Comment 3 Richard Biener 2010-04-08 09:11:36 UTC
Unfolded *&g_7 from PRE.  I have a patch.
Comment 4 Richard Biener 2010-04-08 10:21:40 UTC
Subject: Bug 43679

Author: rguenth
Date: Thu Apr  8 10:21:23 2010
New Revision: 158112

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

	PR tree-optimization/43679
	* tree-ssa-pre.c (eliminate): Only propagate copies.

	* gcc.c-torture/compile/pr43679.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr43679.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-pre.c

Comment 5 Richard Biener 2010-04-08 10:26:09 UTC
Subject: Bug 43679

Author: rguenth
Date: Thu Apr  8 10:25:57 2010
New Revision: 158113

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

	PR tree-optimization/43679
	* tree-ssa-pre.c (eliminate): Only propagate copies.

	* gcc.c-torture/compile/pr43679.c: New testcase.

Added:
    branches/gcc-4_5-branch/gcc/testsuite/gcc.c-torture/compile/pr43679.c
Modified:
    branches/gcc-4_5-branch/gcc/ChangeLog
    branches/gcc-4_5-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_5-branch/gcc/tree-ssa-pre.c

Comment 6 Richard Biener 2010-04-08 10:26:15 UTC
Fixed.