Bug 44977 - [4.4 Regression] ice in propagate_rhs_into_lhs, at tree-ssa-dom.c:2728
Summary: [4.4 Regression] ice in propagate_rhs_into_lhs, at tree-ssa-dom.c:2728
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.4.5
: P3 normal
Target Milestone: 4.4.5
Assignee: Richard Biener
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-18 06:28 UTC by John Regehr
Modified: 2010-07-27 13:05 UTC (History)
3 users (show)

See Also:
Host: x86_64-unknown-linux-gnu
Target: x86_64-unknown-linux-gnu
Build: x86_64-unknown-linux-gnu
Known to work: 4.5.1 4.6.0
Known to fail: 4.4.4 4.5.0
Last reconfirmed: 2010-07-18 18:42:24


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Regehr 2010-07-18 06:28:40 UTC
[regehr@bethe tmp603]$ current-gcc -O2 small.c -c
small.c: In function 'int329':
small.c:31:38: warning: assignment makes integer from pointer without a cast [enabled by default]
small.c:24:5: internal compiler error: in propagate_rhs_into_lhs, at tree-ssa-dom.c:2728
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

[regehr@bethe tmp603]$ cat small.c

static unsigned short
foo (unsigned short ui1, unsigned short ui2)
{
  return ui1 - ui2;
}

static unsigned short
bar (unsigned ui1, unsigned short ui2)
{
  return ui1 + ui2;
}

struct S1
{
  const short f3;
};
int g_31;
short g_67;
struct S1 g_68[2][5][9][1][1] = {
};

int func_90 (int);

int int329 (int * const *const int32p_81, short ** p_82)
{
  short l_169[8];
  for (g_31 = 0; g_31 <= 0; g_31 = foo (g_31, 1))
    {
      short l_85;
    lbl_89:g_67 ^= l_85;
      for (l_85 = 0; l_85 >= 0; l_85 = bar)
        if (g_31)
          goto lbl_89;
      func_90 (1), g_68[0][2][2][0][0].f3, 0;
    }
  return l_169[6];
}

[regehr@bethe tmp603]$ current-gcc -v

Using built-in specs.
COLLECT_GCC=current-gcc
COLLECT_LTO_WRAPPER=/uusoc/exports/scratch/regehr/z/compiler-install/gcc-r162241-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-r162241-install --program-prefix=r162241- --enable-languages=c,c++
Thread model: posix
gcc version 4.6.0 20100716 (experimental) (GCC)
Comment 1 H.J. Lu 2010-07-18 18:01:07 UTC
It is caused by revision 139286:

http://gcc.gnu.org/ml/gcc-cvs/2008-08/msg00848.html
Comment 2 Richard Biener 2010-07-18 18:42:24 UTC
Mine.
Comment 3 Richard Biener 2010-07-20 11:20:03 UTC
#1  0x0000000000aeab84 in propagate_rhs_into_lhs (stmt=0x7ffff5b4d370, 
    lhs=0x7ffff5afc738, rhs=0x7ffff5afc738, interesting_names=0x17b93c8)
    at /space/rguenther/src/svn/trunk/gcc/tree-ssa-dom.c:2728
2728          gcc_assert (!all || has_zero_uses (lhs));
(gdb) p all
$1 = 1 '\001'
(gdb) p lhs
(gdb) call debug_immediate_uses_for (lhs)
g_67.1_6 : --> single use.
g_67.1_6 = g_67.1_6;


We have

<bb 9>:
  # l_85_37 = PHI <0(9), 0(4)>
  # prephitmp.12_36 = PHI <g_67.1_6(9), g_67.1_7(4)>
  g_67.1_6 = prephitmp.12_36 ^ l_85_37;
  goto <bb 9>;

and eliminate_degenerate_phis replaces it with the above through the
intermediate

<bb 9>:
  # prephitmp.12_36 = PHI <g_67.1_6(9)>
  g_67.1_6 = prephitmp.12_36;
  goto <bb 9>;

I have a patch.
Comment 4 Richard Biener 2010-07-20 12:41:40 UTC
Subject: Bug 44977

Author: rguenth
Date: Tue Jul 20 12:41:20 2010
New Revision: 162334

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

	PR tree-optimization/44977
	* tree-ssa-dom.c (propagate_rhs_into_lhs): Do not create invalid
	SSA form.

	* gcc.dg/torture/pr44977.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/torture/pr44977.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-dom.c

Comment 5 Richard Biener 2010-07-20 12:44:47 UTC
Subject: Bug 44977

Author: rguenth
Date: Tue Jul 20 12:44:16 2010
New Revision: 162335

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

	PR tree-optimization/44977
	* tree-ssa-dom.c (propagate_rhs_into_lhs): Do not create invalid
	SSA form.

	* gcc.dg/torture/pr44977.c: New testcase.

Added:
    branches/gcc-4_5-branch/gcc/testsuite/gcc.dg/torture/pr44977.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-dom.c

Comment 6 Richard Biener 2010-07-20 12:45:09 UTC
Fixed on trunk and the 4.5 branch sofar.
Comment 7 Richard Biener 2010-07-27 13:05:29 UTC
Fixed.
Comment 8 Richard Biener 2010-07-27 13:05:37 UTC
Subject: Bug 44977

Author: rguenth
Date: Tue Jul 27 13:05:17 2010
New Revision: 162565

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

	PR tree-optimization/44977
	* tree-ssa-dom.c (propagate_rhs_into_lhs): Do not create invalid
	SSA form.

	* gcc.dg/torture/pr44977.c: New testcase.

Added:
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/torture/pr44977.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-dom.c