Bug 42393 - [4.5 Regression] [graphite] internal compiler error: in check_loop_closed_ssa_use
Summary: [4.5 Regression] [graphite] internal compiler error: in check_loop_closed_ss...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.5.0
: P1 normal
Target Milestone: 4.5.0
Assignee: Sebastian Pop
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2009-12-16 10:59 UTC by Joost VandeVondele
Modified: 2010-01-10 21:47 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2010-01-08 08:22:09


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joost VandeVondele 2009-12-16 10:59:40 UTC
> gfortran  -c -fgraphite-identity -O2 bug.f90
bug.f90: In function ‘basym’:
bug.f90:4:0: internal compiler error: in check_loop_closed_ssa_use, at tree-ssa-loop-manip.c:424
Please submit a full bug report,
with preprocessed source if appropriate.

> cat bug.f90
MODULE beta_gamma_psi
  INTEGER, PARAMETER :: dp=KIND(0.0D0)
CONTAINS
FUNCTION basym (a, b, lambda, eps) RESULT(fn_val)
    REAL(dp) :: a0(21), b0(21), bsum, c(21), d(21), dsum, &
      j0, j1, r, r0, r1, s, sum, t, t0, t1, &
      u, w, w0, z, z0, z2, zn, znm1
DO n = 2, num, 2
  DO i = n, np1
    b0(1) = r*a0(1)
    DO m = 2, i
      bsum = 0.0e0_dp
      mm1 = m - 1
      DO j = 1, mm1
        mmj = m - j
        bsum = bsum + (j*r - mmj)*a0(j)*b0(mmj)
      END DO
      b0(m) = r*a0(m) + bsum/m
    END DO
    c(i) = b0(i)/(i + 1.0e0_dp)
    d(i) = -(dsum + c(i))
  END DO
  t0 = d(n)*w*j0
  sum = sum + (t0 + t1)
END DO
fn_val = e0*t*u*sum
END FUNCTION basym
END MODULE beta_gamma_psi

> gfortran  -v -c -fgraphite-identity -O2 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 20091216 (experimental) [trunk revision 155286] (GCC)
COLLECT_GCC_OPTIONS='-v' '-c' '-fgraphite-identity' '-O2' '-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 -O2 -version -fgraphite-identity -fintrinsic-modules-path /data03/vondele/gcc_trunk/build/lib/gcc/x86_64-unknown-linux-gnu/4.5.0/finclude -o /tmp/ccrCN2bx.s
GNU Fortran (GCC) version 4.5.0 20091216 (experimental) [trunk revision 155286] (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 20091216 (experimental) [trunk revision 155286] (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 ‘basym’:
bug.f90:4:0: internal compiler error: in check_loop_closed_ssa_use, at tree-ssa-loop-manip.c:424
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
Comment 1 Sebastian Pop 2009-12-18 06:25:49 UTC
Subject: Bug 42393

Author: spop
Date: Fri Dec 18 06:25:32 2009
New Revision: 155336

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155336
Log:
Fix PR42393.

2009-12-17  Sebastian Pop  <sebastian.pop@amd.com>

	PR middle-end/42393
	* testsuite/gfortran.dg/graphite/pr42393.f90: New.

Added:
    branches/graphite/gcc/testsuite/gfortran.dg/graphite/pr42393.f90
Modified:
    branches/graphite/gcc/ChangeLog.graphite

Comment 2 Sebastian Pop 2009-12-18 06:26:29 UTC
Fixed in the Graphite branch.
Comment 3 Richard Biener 2009-12-18 12:39:52 UTC
Reopen.  Still a 4.5 regression.
Comment 4 Sebastian Pop 2009-12-23 07:51:25 UTC
Subject: Bug 42393

Author: spop
Date: Wed Dec 23 07:50:43 2009
New Revision: 155421

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155421
Log:
Fix PR42393.

2009-12-17  Sebastian Pop  <sebastian.pop@amd.com>

	PR middle-end/42393
	* testsuite/gfortran.dg/graphite/pr42393.f90: New.

Added:
    trunk/gcc/testsuite/gfortran.dg/graphite/pr42393.f90
Modified:
    trunk/gcc/ChangeLog.graphite

Comment 5 Sebastian Pop 2009-12-23 07:53:58 UTC
Fixed.
Comment 6 Sebastian Pop 2009-12-23 18:27:41 UTC
Seems like this is fixed by the patch from PR42221.
Comment 7 Jack Howarth 2009-12-24 02:37:13 UTC
Still fails on x86_64-apple-darwin10 at r155434...

Executing on host: /sw/src/fink.build/gcc45-4.4.999-20091223/darwin_objdir/gcc/testsuite/gfortran/../../gfortran -B/sw/src/fink.build/gcc45-4.4.999-20091223/darwin_objdir/gcc/testsuite/gfortran/../../ /sw/src/fink.build/gcc45-4.4.999-20091223/gcc-4.5-20091223/gcc/testsuite/gfortran.dg/graphite/pr42393.f90   -O  -fgraphite-identity -O2 -S  -o pr42393.s    (timeout = 300)
/sw/src/fink.build/gcc45-4.4.999-20091223/gcc-4.5-20091223/gcc/testsuite/gfortran.dg/graphite/pr42393.f90: In function 'basym':
/sw/src/fink.build/gcc45-4.4.999-20091223/gcc-4.5-20091223/gcc/testsuite/gfortran.dg/graphite/pr42393.f90:6:0: internal compiler error: in check_loop_closed_ssa_use, at tree-ssa-loop-manip.c:424
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
compiler exited with status 1
output is:
/sw/src/fink.build/gcc45-4.4.999-20091223/gcc-4.5-20091223/gcc/testsuite/gfortran.dg/graphite/pr42393.f90: In function 'basym':
/sw/src/fink.build/gcc45-4.4.999-20091223/gcc-4.5-20091223/gcc/testsuite/gfortran.dg/graphite/pr42393.f90:6:0: internal compiler error: in check_loop_closed_ssa_use, at tree-ssa-loop-manip.c:424
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

FAIL: gfortran.dg/graphite/pr42393.f90  -O  (internal compiler error)
FAIL: gfortran.dg/graphite/pr42393.f90  -O  (test for excess errors)
Excess errors:
/sw/src/fink.build/gcc45-4.4.999-20091223/gcc-4.5-20091223/gcc/testsuite/gfortran.dg/graphite/pr42393.f90:6:0: internal compiler error: in check_loop_closed_ssa_use, at tree-ssa-loop-manip.c:424

Comment 8 Jack Howarth 2009-12-24 03:56:51 UTC
This can't be backtraced after the crash but the last breakpoint on tree-ssa-loop-manip.c:425 before the crash shows...

Breakpoint 1, check_loop_closed_ssa_use (bb=0x141e793a8, use=0x141e90160) at ../../gcc-4.5-20091223/gcc/tree-ssa-loop-manip.c:425
425	}
#0  check_loop_closed_ssa_use (bb=0x141e793a8, use=0x141e90160) at ../../gcc-4.5-20091223/gcc/tree-ssa-loop-manip.c:425
#1  0x00000001007b9010 in verify_loop_closed_ssa () at ../../gcc-4.5-20091223/gcc/tree-ssa-loop-manip.c:464
#2  0x0000000100527d99 in translate_clast (region=<value temporarily unavailable, due to optimizations>, stmt=<value temporarily unavailable, due to optimizations>, next_e=<value temporarily unavailable, due to optimizations>, rename_map=<value temporarily unavailable, due to optimizations>, newivs=<value temporarily unavailable, due to optimizations>, newivs_index=<value temporarily unavailable, due to optimizations>, bb_pbb_mapping=<value temporarily unavailable, due to optimizations>, params_index=<value temporarily unavailable, due to optimizations>) at ../../gcc-4.5-20091223/gcc/graphite-clast-to-gimple.c:65
#3  0x00000001005286fc in translate_clast (region=<value temporarily unavailable, due to optimizations>, stmt=<value temporarily unavailable, due to optimizations>, next_e=<value temporarily unavailable, due to optimizations>, rename_map=<value temporarily unavailable, due to optimizations>, newivs=<value temporarily unavailable, due to optimizations>, newivs_index=<value temporarily unavailable, due to optimizations>, bb_pbb_mapping=<value temporarily unavailable, due to optimizations>, params_index=<value temporarily unavailable, due to optimizations>) at ../../gcc-4.5-20091223/gcc/graphite-clast-to-gimple.c:832
#4  0x000000010052a294 in gloog (scop=<value temporarily unavailable, due to optimizations>, bb_pbb_mapping=<value temporarily unavailable, due to optimizations>) at ../../gcc-4.5-20091223/gcc/graphite-clast-to-gimple.c:1451
#5  0x0000000100523882 in graphite_transform_loops () at ../../gcc-4.5-20091223/gcc/graphite.c:277
#6  0x00000001007c734a in graphite_transforms () at ../../gcc-4.5-20091223/gcc/tree-ssa-loop.c:300
#7  0x00000001006095ee in execute_one_pass (pass=0x100c7fda0) at ../../gcc-4.5-20091223/gcc/passes.c:1561
#8  0x00000001006098bd in execute_pass_list (pass=0x100c7fda0) at ../../gcc-4.5-20091223/gcc/passes.c:1616
#9  0x00000001006098cf in execute_pass_list (pass=0x100c7fb00) at ../../gcc-4.5-20091223/gcc/passes.c:1617
#10 0x00000001006098cf in execute_pass_list (pass=0x100c7f140) at ../../gcc-4.5-20091223/gcc/passes.c:1617
#11 0x0000000100738d58 in tree_rest_of_compilation (fndecl=0x141df1c00) at ../../gcc-4.5-20091223/gcc/tree-optimize.c:413
#12 0x00000001008f37f3 in cgraph_expand_function (node=<value temporarily unavailable, due to optimizations>) at ../../gcc-4.5-20091223/gcc/cgraphunit.c:1544
#13 0x00000001008f66ea in cgraph_optimize () at ../../gcc-4.5-20091223/gcc/cgraphunit.c:1623
#14 0x00000001008f6ccd in cgraph_finalize_compilation_unit () at ../../gcc-4.5-20091223/gcc/cgraphunit.c:1093
#15 0x000000010059b8b6 in write_global_declarations () at ../../gcc-4.5-20091223/gcc/langhooks.c:309
#16 0x00000001006ce9c2 in toplev_main (argc=18, argv=0x7fff5fbfd9c8) at ../../gcc-4.5-20091223/gcc/toplev.c:1061
#17 0x0000000100001534 in start ()
/sw/src/fink.build/gcc45-4.4.999-20091223/gcc-4.5-20091223/gcc/testsuite/gfortran.dg/graphite/pr42393.f90: In function ‘basym’:
/sw/src/fink.build/gcc45-4.4.999-20091223/gcc-4.5-20091223/gcc/testsuite/gfortran.dg/graphite/pr42393.f90:6:0: internal compiler error: in check_loop_closed_ssa_use, at tree-ssa-loop-manip.c:424
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

Program exited with code 04.
Comment 9 Dominique d'Humieres 2010-01-01 16:05:49 UTC
Confirmed with both -m32 or -m64 on x86_64-apple-darwin10 (revision 155540) and on powerpc-apple-darwin9 (revision 155525: see http://gcc.gnu.org/ml/gcc-testresults/2010-01/msg00043.html ).

Also fails on x86_64-unknown-linux-gnu (revision 155546, see http://gcc.gnu.org/ml/gcc-testresults/2010-01/msg00048.html ).
Comment 10 Sebastian Pop 2010-01-08 08:22:09 UTC
Mine.
Comment 11 Sebastian Pop 2010-01-08 18:58:01 UTC
On the graphite branch this fails with the following options:
gfortran -O2 -fno-loop-block -fno-loop-interchange -fno-loop-strip-mine -fgraphite-identity pr42393.f90
Here is a further reduced testcase.

MODULE beta_gamma_psi
  INTEGER, PARAMETER :: dp=KIND(0.0D0)
CONTAINS
  FUNCTION basym () RESULT(fn_val)
    REAL(dp) :: b0(21), bsum, d(21)
    DO n = 2, num, 2
       DO i = n, np1
          b0(1) = 1
          DO m = 2, i
             mm1 = m - 1
             DO j = 1, mm1
                bsum = bsum + b0(j)
             END DO
             b0(m) = bsum
          END DO
          d(i) = -b0(i)
       END DO
       sum = sum + d(n)
    END DO
    fn_val = sum
  END FUNCTION basym
END MODULE beta_gamma_psi

The problem seems to be in the code generation when replacing the end
value from a loop.
Comment 12 Sebastian Pop 2010-01-10 20:46:42 UTC
Subject: Bug 42393

Author: spop
Date: Sun Jan 10 20:46:28 2010
New Revision: 155793

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155793
Log:
Fix PR42393.

2010-01-08  Sebastian Pop  <sebastian.pop@amd.com>

	PR middle-end/42393
	* graphite-clast-to-gimple.c: Fix formatting.
	* sese.c (defined_in_loop_p): Renamed name_defined_in_loop_p.
	(expr_defined_in_loop_p): New.
	(add_loop_exit_phis): Also handle full expressions: remove from
	the rename_map the expressions defined in the loop that we're closing.

	* testsuite/gfortran.dg/graphite/pr42393-1.f90: New.
	* testsuite/gfortran.dg/graphite/pr42393.f90: Add new flags
	-fno-loop-block -fno-loop-interchange -fno-loop-strip-mine to also
	make this testcase useful in the Graphite branch.

Added:
    branches/graphite/gcc/testsuite/gfortran.dg/graphite/pr42393-1.f90
Modified:
    branches/graphite/gcc/ChangeLog.graphite
    branches/graphite/gcc/graphite-clast-to-gimple.c
    branches/graphite/gcc/sese.c
    branches/graphite/gcc/testsuite/gfortran.dg/graphite/pr42393.f90

Comment 13 Sebastian Pop 2010-01-10 21:46:54 UTC
Subject: Bug 42393

Author: spop
Date: Sun Jan 10 21:46:42 2010
New Revision: 155795

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155795
Log:
Fix PR42393.

2010-01-08  Sebastian Pop  <sebastian.pop@amd.com>

	PR middle-end/42393
	* graphite-clast-to-gimple.c: Fix formatting.
	* sese.c (defined_in_loop_p): Renamed name_defined_in_loop_p.
	(expr_defined_in_loop_p): New.
	(add_loop_exit_phis): Also handle full expressions: remove from
	the rename_map the expressions defined in the loop that we're closing.

	* testsuite/gfortran.dg/graphite/pr42393-1.f90: New.
	* testsuite/gfortran.dg/graphite/pr42393.f90: Add new flags
	-fno-loop-block -fno-loop-interchange -fno-loop-strip-mine to also
	make this testcase useful in the Graphite branch.

Added:
    trunk/gcc/testsuite/gfortran.dg/graphite/pr42393-1.f90
Modified:
    trunk/gcc/ChangeLog.graphite
    trunk/gcc/graphite-clast-to-gimple.c
    trunk/gcc/sese.c
    trunk/gcc/testsuite/gfortran.dg/graphite/pr42393.f90

Comment 14 Sebastian Pop 2010-01-10 21:47:12 UTC
Fixed.