Bug 42717 - [4.5 Regression] ice: verify_ssa failed
Summary: [4.5 Regression] ice: verify_ssa failed
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.5.0
: P1 normal
Target Milestone: 4.5.0
Assignee: Richard Biener
URL:
Keywords: ice-checking, ice-on-valid-code, wrong-code
Depends on:
Blocks:
 
Reported: 2010-01-12 18:03 UTC by John Regehr
Modified: 2010-01-20 12:30 UTC (History)
3 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work: 4.4.2
Known to fail: 4.5.0
Last reconfirmed: 2010-01-15 16:07:34


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Regehr 2010-01-12 18:03:53 UTC
Seen on Ubuntu 9.10.

regehr@john-home:~/volatile/bugs/tmp253$ current-gcc -O2 small.c
small.c: In function ‘bar’:
small.c:16:1: error: definition in block 7 does not dominate use in block 2
for SSA_NAME: l_23_17 in statement:
l_23_2 = PHI <l_23_17(7), l_23_17(2)>
PHI argument
l_23_17
for PHI node
l_23_2 = PHI <l_23_17(7), l_23_17(2)>
small.c:16:1: internal compiler error: verify_ssa failed
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/tmp253$ current-gcc -v

Using built-in specs.
COLLECT_GCC=current-gcc
COLLECT_LTO_WRAPPER=/home/regehr/z/tmp/gcc-r155838-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/tmp/gcc-r155838-install --program-prefix=r155838- --enable-languages=c,c++
Thread model: posix
gcc version 4.5.0 20100112 (experimental) (GCC) 

regehr@john-home:~/volatile/bugs/tmp253$ cat small.c

static signed char
foo (signed char si1, unsigned char si2)
{
  return (si1 ^ si2) & (-si2 ^ si2) ? : si1 - si2;
}

struct S0
{
};

unsigned char g_21;

struct S0 g_34;

void
bar (unsigned char p_20)
{
  unsigned char *l_22 = &g_21;
  unsigned char l_23 = 0;
  struct S0 *l = &g_34;
  goto lbl_42;
  for (; l_23; l_23 = foo (l_23, 1))
    {
      for (p_20 = 0; 0; p_20 = foo (p_20, 1))
      lbl_42:;
      (l == &g_34) ? 0 : "";
    lbl_85:*l_22 = p_20;
    }
  goto lbl_85;
}
Comment 1 H.J. Lu 2010-01-13 01:17:47 UTC
It is caused by revision 149199:

http://gcc.gnu.org/ml/gcc-cvs/2009-07/msg00076.html
Comment 2 Richard Biener 2010-01-13 13:16:16 UTC
This:

      /* We are sure that for every live PHI we are seeing control dependent BB.
         This means that we can look up the end of control dependent path leading
         to the PHI itself.  */
      FOR_EACH_EDGE (e2, ei, post_dom_bb->preds)
        if (e2 != e && dominated_by_p (CDI_POST_DOMINATORS, e->src, e2->src))
          break;

is broken.

We redirect lbl_42 -> bb 4 to bb 7 in

<bb 2>:

lbl_42:
  p_20.0_8 = (signed char) p_20_7(D);
  D.2736_9 = (int) p_20.0_8;
  D.2769_26 = D.2736_9 ^ 1;
  D.2766_31 = D.2769_26 & -2;
  if (D.2766_31 != 0)
    goto <bb 4>;
  else
    goto <bb 5>;

<bb 4>:
  D.2763_32 = (signed char) D.2766_31;
  goto <bb 6>;

<bb 5>:
  D.2764_34 = p_20_7(D) + 255;
  D.2763_35 = (signed char) D.2764_34;

<bb 6>:
  # D.2763_36 = PHI <D.2763_32(4), D.2763_35(5)>
  p_20_11 = (unsigned char) D.2763_36;

<bb 7>:
  # l_23_2 = PHI <l_23_17(12), 0(6)>

but instead of finding 6 -> 7 we find 12 -> 7, a loop backedge.  We have
to find the correct path leading to the PHI node in case there is an
ambiguity like here.

Not sure if excluding back edges is enough, but certainly a back edge
cannot be the correct one?

Well.  I'm testing a patch.
Comment 3 Richard Biener 2010-01-13 15:01:50 UTC
Doesn't work.

FAIL: gcc.c-torture/execute/20010129-1.c compilation,  -O3 -fomit-frame-pointer 
 (internal compiler error)
Comment 4 Richard Biener 2010-01-15 16:07:34 UTC
Testing sth else.
Comment 5 Richard Biener 2010-01-20 12:30:31 UTC
Fixed.
Comment 6 Richard Biener 2010-01-20 12:30:44 UTC
Subject: Bug 42717

Author: rguenth
Date: Wed Jan 20 12:30:15 2010
New Revision: 156076

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

	PR tree-optimization/42717
	* tree-ssa-dce.c (get_live_post_dom): Remove.
	(forward_edge_to_pdom): Take an arbitrary edge to copy
	degenerate PHI args from.
	(remove_dead_stmt): Use the first post-dominator even if it
	does not contain live statements as redirection destination.

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

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr42717.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-dce.c

Comment 7 hjl@gcc.gnu.org 2010-02-07 04:43:05 UTC
Subject: Bug 42717

Author: hjl
Date: Sun Feb  7 04:41:22 2010
New Revision: 156562

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=156562
Log:
Backport testcases from mainline to 4.4.

2010-02-06  H.J. Lu  <hongjiu.lu@intel.com>

	Backport from mainline:
	2010-02-05  Dodji Seketeli  <dodji@redhat.com>

	PR c++/42915
	* g++.dg/other/crash-9.C: New test.

	2010-02-03  Jason Merrill  <jason@redhat.com>

	PR c++/40138
	* g++.dg/ext/builtin11.C: New.

	2010-02-03  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/42944
	* gcc.dg/errno-1.c: New testcase.

	2010-02-03  Richard Guenther  <rguenther@suse.de>

	PR middle-end/42927
	* gcc.c-torture/compile/pr42927.c: New testcase.

	2010-01-29  Dodji Seketeli  <dodji@redhat.com>

	PR c++/42758
	PR c++/42634
	PR c++/42336
	PR c++/42797
	PR c++/42880
	* g++.dg/other/crash-5.C: New test.
	* g++.dg/other/crash-7.C: New test.
	* g++.dg/other/crash-8.C: New test.

	2010-01-28  Uros Bizjak  <ubizjak@gmail.com>

	PR target/42891
	* gcc.target/i386/pr42891.c: New test.

	2010-01-28  Richard Guenther  <rguenther@suse.de>

	PR middle-end/42883
	* g++.dg/torture/pr42883.C: New testcase.

	2010-01-28  Michael Matz  <matz@suse.de>

	* gcc.target/i386/pr42881.c: New test.

	2010-01-28  Dodji Seketeli  <dodji@redhat.com>

	PR c++/42713
	PR c++/42820
	* g++.dg/template/typedef27.C: New test case.
	* g++.dg/template/typedef28.C: New test case.

	2010-01-27  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/42874
	* gcc.dg/vla-22.c: New test.

	2010-01-26  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/42250
	* gcc.dg/pr42250.c: New testcase.

	2010-01-25  Tobias Burnus  <burnus@net-b.de>

	PR fortran/42858
	* gfortran.dg/generic_21.f90: New test.

	2010-01-21  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/42585
	* gcc.dg/tree-ssa/pr42585.c: New test.

	2010-01-20  Alexandre Oliva  <aoliva@redhat.com>

	PR debug/42715
	* gcc.dg/pr42715.c: New.

	2010-01-20  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/42717
	* gcc.c-torture/compile/pr42717.c: New testcase.

	2010-01-19  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/42783
	* gfortran.dg/bounds_check_15.f90 : New test.

	2010-01-18  Dodji Seketeli  <dodji@redhat.com>

	PR c++/42766
	* g++.dg/conversion/op6.C: New test.

	2010-01-18  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/42781
	* gfortran.fortran-torture/compile/pr42781.f90: New testcase.

	2010-01-17  Richard Guenther  <rguenther@suse.de>

	PR middle-end/42248
	* gcc.c-torture/execute/pr42248.c: New testcase.

	2010-01-17  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/42677
	* gfortran.dg/interface_assignment_5.f90: New test.

	2010-01-15  Richard Guenther  <rguenther@suse.de>

	PR middle-end/42739
	* g++.dg/torture/pr42739.C: New testcase.

	2010-01-14 Jerry DeLisle <jvdelisle@gcc.gnu.org>

	PR fortran/42684
	* gfortran.dg/interface_31.f90: New test.

	2010-01-14  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/42706
	* gcc.dg/ipa/pr42706.c: New testcase.

	2010-01-14  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/42714
	* g++.dg/torture/pr42714.C: New test.

	2010-01-14  Alexander Monakov  <amonakov@ispras.ru>

	PR rtl-optimization/42388
	* gcc.dg/pr42388.c: New.

	2010-01-14  Alexander Monakov <amonakov@ispras.ru>

	PR rtl-optimization/42294
	* gfortran.dg/pr42294.f: New.

	2010-01-14  Ira Rosen  <irar@il.ibm.com>

	PR tree-optimization/42709
	* gcc.dg/vect/pr42709.c: New test.

	2010-01-13  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/42730
	* gcc.c-torture/compile/pr42730.c: New testcase.

	2010-01-13  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/42704
	* g++.dg/torture/pr42704.C: New test.

	2010-01-13  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/42703
	* gcc.c-torture/compile/pr42703.c: New test.

	2010-01-13  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/42705
	* gcc.c-torture/compile/pr42705.c: New testcase.

	2010-01-13  Richard Guenther  <rguenther@suse.de>

	PR middle-end/42716
	* gcc.c-torture/compile/pr42716.c: New testcase.

	2010-01-12  Joseph Myers  <joseph@codesourcery.com>

	PR c/42708
	* gcc.c-torture/compile/pr42708-1.c: New test.

	2010-01-09  Alexandre Oliva  <aoliva@redhat.com>

	PR middle-end/42363
	* gcc.dg/torture/pr42363.c: New.

	2010-01-09  Alexandre Oliva  <aoliva@redhat.com>

	PR debug/42604
	PR debug/42395
	* gcc.dg/vect/pr42604.c: New.
	* gcc.dg/vect/pr42395.c: New.

	2010-01-09  Richard Guenther  <rguenther@suse.de>

	PR middle-end/42512
	* gcc.c-torture/execute/pr42512.c: New testcase.

Added:
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/conversion/op6.C
      - copied unchanged from r156561, trunk/gcc/testsuite/g++.dg/conversion/op6.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/ext/builtin11.C
      - copied unchanged from r156561, trunk/gcc/testsuite/g++.dg/ext/builtin11.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/other/crash-5.C
      - copied unchanged from r156561, trunk/gcc/testsuite/g++.dg/other/crash-5.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/other/crash-7.C
      - copied unchanged from r156561, trunk/gcc/testsuite/g++.dg/other/crash-7.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/other/crash-8.C
      - copied unchanged from r156561, trunk/gcc/testsuite/g++.dg/other/crash-8.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/other/crash-9.C
      - copied unchanged from r156561, trunk/gcc/testsuite/g++.dg/other/crash-9.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/template/typedef27.C
      - copied unchanged from r156561, trunk/gcc/testsuite/g++.dg/template/typedef27.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/template/typedef28.C
      - copied unchanged from r156561, trunk/gcc/testsuite/g++.dg/template/typedef28.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/torture/pr42704.C
      - copied unchanged from r156561, trunk/gcc/testsuite/g++.dg/torture/pr42704.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/torture/pr42714.C
      - copied unchanged from r156561, trunk/gcc/testsuite/g++.dg/torture/pr42714.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/torture/pr42739.C
      - copied unchanged from r156561, trunk/gcc/testsuite/g++.dg/torture/pr42739.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/torture/pr42883.C
      - copied unchanged from r156561, trunk/gcc/testsuite/g++.dg/torture/pr42883.C
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr42703.c
      - copied unchanged from r156561, trunk/gcc/testsuite/gcc.c-torture/compile/pr42703.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr42705.c
      - copied unchanged from r156561, trunk/gcc/testsuite/gcc.c-torture/compile/pr42705.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr42708-1.c
      - copied unchanged from r156561, trunk/gcc/testsuite/gcc.c-torture/compile/pr42708-1.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr42716.c
      - copied unchanged from r156561, trunk/gcc/testsuite/gcc.c-torture/compile/pr42716.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr42717.c
      - copied unchanged from r156561, trunk/gcc/testsuite/gcc.c-torture/compile/pr42717.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr42730.c
      - copied unchanged from r156561, trunk/gcc/testsuite/gcc.c-torture/compile/pr42730.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr42927.c
      - copied unchanged from r156561, trunk/gcc/testsuite/gcc.c-torture/compile/pr42927.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/execute/pr42248.c
      - copied unchanged from r156561, trunk/gcc/testsuite/gcc.c-torture/execute/pr42248.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/execute/pr42512.c
      - copied unchanged from r156561, trunk/gcc/testsuite/gcc.c-torture/execute/pr42512.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/errno-1.c
      - copied unchanged from r156561, trunk/gcc/testsuite/gcc.dg/errno-1.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/ipa/pr42706.c
      - copied unchanged from r156561, trunk/gcc/testsuite/gcc.dg/ipa/pr42706.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/pr42250.c
      - copied unchanged from r156561, trunk/gcc/testsuite/gcc.dg/pr42250.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/pr42388.c
      - copied unchanged from r156561, trunk/gcc/testsuite/gcc.dg/pr42388.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/pr42715.c
      - copied unchanged from r156561, trunk/gcc/testsuite/gcc.dg/pr42715.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/torture/pr42363.c
      - copied unchanged from r156561, trunk/gcc/testsuite/gcc.dg/torture/pr42363.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/tree-ssa/pr42585.c
      - copied unchanged from r156561, trunk/gcc/testsuite/gcc.dg/tree-ssa/pr42585.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/vect/pr42395.c
      - copied unchanged from r156561, trunk/gcc/testsuite/gcc.dg/vect/pr42395.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/vect/pr42604.c
      - copied unchanged from r156561, trunk/gcc/testsuite/gcc.dg/vect/pr42604.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/vect/pr42709.c
      - copied unchanged from r156561, trunk/gcc/testsuite/gcc.dg/vect/pr42709.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/vla-22.c
      - copied unchanged from r156561, trunk/gcc/testsuite/gcc.dg/vla-22.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.target/i386/pr42881.c
      - copied unchanged from r156561, trunk/gcc/testsuite/gcc.target/i386/pr42881.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.target/i386/pr42891.c
      - copied unchanged from r156561, trunk/gcc/testsuite/gcc.target/i386/pr42891.c
    branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/bounds_check_15.f90
      - copied unchanged from r156561, trunk/gcc/testsuite/gfortran.dg/bounds_check_15.f90
    branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/generic_21.f90
      - copied unchanged from r156561, trunk/gcc/testsuite/gfortran.dg/generic_21.f90
    branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/interface_31.f90
      - copied unchanged from r156561, trunk/gcc/testsuite/gfortran.dg/interface_31.f90
    branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/interface_assignment_5.f90
      - copied unchanged from r156561, trunk/gcc/testsuite/gfortran.dg/interface_assignment_5.f90
    branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/pr42294.f
      - copied unchanged from r156561, trunk/gcc/testsuite/gfortran.dg/pr42294.f
    branches/gcc-4_4-branch/gcc/testsuite/gfortran.fortran-torture/compile/pr42781.f90
      - copied unchanged from r156561, trunk/gcc/testsuite/gfortran.fortran-torture/compile/pr42781.f90
Modified:
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog