Bug 42166 - [4.5 Regression] internal compiler error: verify_ssa failed
Summary: [4.5 Regression] internal compiler error: verify_ssa failed
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: debug (show other bugs)
Version: 4.5.0
: P1 normal
Target Milestone: 4.5.0
Assignee: Richard Henderson
URL:
Keywords: ice-on-valid-code
: 42299 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-11-24 18:44 UTC by Joost VandeVondele
Modified: 2009-12-07 23:31 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.4.2
Known to fail:
Last reconfirmed: 2009-12-07 17:37:27


Attachments
Proposed patch (448 bytes, patch)
2009-12-07 21:00 UTC, Richard Henderson
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joost VandeVondele 2009-11-24 18:44:59 UTC
> gfortran -c -fbounds-check -g  -O3    bug.f90
bug.f90: In function ‘newuob’:
bug.f90:4:0: error: definition in block 11 does not dominate use in block 17
for SSA_NAME: sum_4 in statement:
# DEBUG sum => D#1 + sum_4
bug.f90:4:0: 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.

> cat bug.f90
MODULE powell
  INTEGER, PARAMETER :: dp=8
CONTAINS
  SUBROUTINE newuob (n,  bmat,  ndim,  d,  vlag,  w,opt )
    REAL(dp), DIMENSION(ndim, *), INTENT(inout) :: bmat
    REAL(dp), DIMENSION(*), INTENT(inout)    :: d, vlag, w
    REAL(dp) :: sum
    DO j=1,n
       jp=npt+j
       DO k=1,n
          sum=sum+bmat(jp,k)*d(k)
       END DO
       vlag(jp)=sum
    END DO
  END SUBROUTINE newuob
END MODULE powell

details are:
> gfortran -c -fbounds-check -g  -O3  -v   bug.f90
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/data03/vondele/gcc_trunk/build/libexec/gcc/x86_64-unknown-linux-gnu/4.5.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /data03/vondele/gcc_trunk/gcc/configure --disable-bootstrap --prefix=/data03/vondele/gcc_trunk/build --enable-languages=c,c++,fortran --disable-multilib --with-ppl=/data03/vondele/gcc_trunk/build/ --with-cloog=/data03/vondele/gcc_trunk/build/ --with-libelf=/data03/vondele/libelf-0.8.12/build/ --enable-gold --enable-lto --enable-plugins
Thread model: posix
gcc version 4.5.0 20091121 (experimental) [trunk revision 154408] (GCC)
COLLECT_GCC_OPTIONS='-c' '-fbounds-check' '-g' '-O3' '-v' '-mtune=generic'
 /data03/vondele/gcc_trunk/build/libexec/gcc/x86_64-unknown-linux-gnu/4.5.0/f951 bug.f90 -quiet -dumpbase bug.f90 -mtune=generic -auxbase bug -g -O3 -version -fbounds-check -fintrinsic-modules-path /data03/vondele/gcc_trunk/build/lib/gcc/x86_64-unknown-linux-gnu/4.5.0/finclude -o /tmp/cccpthTj.s
GNU Fortran (GCC) version 4.5.0 20091121 (experimental) [trunk revision 154408] (x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.3.1 20080507 (prerelease) [gcc-4_3-branch revision 135036], GMP version 4.2.4, MPFR version 2.4.1, MPC version 0.8
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU Fortran (GCC) version 4.5.0 20091121 (experimental) [trunk revision 154408] (x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.3.1 20080507 (prerelease) [gcc-4_3-branch revision 135036], GMP version 4.2.4, MPFR version 2.4.1, MPC version 0.8
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
bug.f90: In function ‘newuob’:
bug.f90:4:0: error: definition in block 11 does not dominate use in block 17
for SSA_NAME: sum_4 in statement:
# DEBUG sum => D#1 + sum_4
bug.f90:4:0: 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.
Comment 1 Joost VandeVondele 2009-11-24 19:20:10 UTC
and confirmed for current trunk.
gcc version 4.5.0 20091124 (experimental) [trunk revision 154511] (GCC)
Comment 2 Richard Biener 2009-11-27 11:30:30 UTC
Confirmed.  The ICE is from verify-ssa after DOM which threads some jumps.
Comment 3 Andrew Pinski 2009-12-03 05:17:36 UTC
Interesting it works for LP32 targets.
Comment 4 Andrew Pinski 2009-12-03 05:32:45 UTC
More interesting is that if I turn off IV-opts, it works.
Comment 5 Richard Henderson 2009-12-07 20:31:38 UTC
There appears to be a phase ordering problem.

We duplicate a block in create_block_for_threading, which leaves users
of various SSA names dangling waiting on a subsequent update_ssa.

Before we get to that update_ssa we cleanup the cfg (as we must -- ssa
update can't handle unreachable blocks).  In the process of deleting
the unreachable blocks we propagate the definition of a PHI which we 
are removing into its use in a DEBUG stmt.

The problem being that the debug stmt in question isn't supposed to be
referencing that PHI anymore.  That debug stmt is in the new duplicate
block and is supposed to be referencing the new PHI.
Comment 6 Richard Henderson 2009-12-07 21:00:48 UTC
Created attachment 19253 [details]
Proposed patch

I'm testing this to account for the ssa_name marked for renaming problem.
Comment 7 Richard Henderson 2009-12-07 22:16:58 UTC
*** Bug 42299 has been marked as a duplicate of this bug. ***
Comment 8 Richard Henderson 2009-12-07 22:42:25 UTC
Subject: Bug 42166

Author: rth
Date: Mon Dec  7 22:42:10 2009
New Revision: 155063

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155063
Log:
	PR debug/42299
	PR debug/42166
	* tree-ssa.c (insert_debug_temp_for_var_def): Skip propagation
	for ssa names already registered for update.

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr42299.c
    trunk/gcc/testsuite/gfortran.dg/pr42166.f90
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/tree-ssa.c

Comment 9 Richard Henderson 2009-12-07 23:31:38 UTC
Fixed.
Comment 10 hjl@gcc.gnu.org 2009-12-12 01:45:47 UTC
Subject: Bug 42166

Author: hjl
Date: Sat Dec 12 01:45:12 2009
New Revision: 155191

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155191
Log:
Backport testcases from trunk.

2009-12-11  H.J. Lu  <hongjiu.lu@intel.com>

	Backport from mainline:
	2009-12-07  Richard Henderson  <rth@redhat.com>

	PR rtl-opt/42269
	* gcc.c-torture/execute/pr42269-2.c: New.

	2009-12-07  Richard Henderson  <rth@redhat.com>

	PR debug/42299
	PR debug/42166
	* gcc.c-torture/compile/pr42299.c: New.
	* gfortran.dg/pr42166.f90: Likewise.

	2009-12-06  Richard Henderson  <rth@redhat.com>

	PR debug/42234
	* gcc.c-torture/compile/pr42234.c: New.

	2009-12-02  Richard Henderson  <rth@redhat.com>

	PR tree-opt/42215
	* gcc.dg/pr42215.c: New.

Added:
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr42234.c
      - copied unchanged from r155190, trunk/gcc/testsuite/gcc.c-torture/compile/pr42234.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr42299.c
      - copied unchanged from r155190, trunk/gcc/testsuite/gcc.c-torture/compile/pr42299.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/execute/pr42269-2.c
      - copied unchanged from r155190, trunk/gcc/testsuite/gcc.c-torture/execute/pr42269-2.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/pr42215.c
      - copied unchanged from r155190, trunk/gcc/testsuite/gcc.dg/pr42215.c
    branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/pr42166.f90
      - copied unchanged from r155190, trunk/gcc/testsuite/gfortran.dg/pr42166.f90
Modified:
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog