$ /usr/local/gfortran/bin/gfortran -c -fno-second-underscore -fdefault-integer-8 -m64 -DMOLPRO -I. -I.. -I../global -O3 dftgrid.f dftgrid.f: In function 'grid_neighbour_dint': dftgrid.f:4288: internal compiler error: vector VEC(tree,base) index domain error, in vectorizable_store at tree-vect-transform.c:5358 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. $ gfortran -v Using built-in specs. Target: i386-apple-darwin8.10.1 Configured with: /tmp/gfortran-20090321/ibin/../gcc/configure --prefix=/usr/local/gfortran --enable-languages=c,fortran --with-gmp=/tmp/gfortran-20090321/gfortran_libs --enable-bootstrap Thread model: posix gcc version 4.4.0 20090321 (experimental) [trunk revision 144983] (GCC) $ /usr/local/gfortran/bin/gfortran -c -fno-second-underscore -fdefault-integer-8 -m64 -DMOLPRO -I. -I.. -I../global -O2 dftgrid
Created attachment 17567 [details] source and includes that demonstrate the problem
Confirmed.
Simplified testcase: c { dg-do compile } c { dg-options "-O3" } subroutine foo(a,c,i,m) double precision a(4,*),b(3,64),c(3,200),d(64) integer*8 i,j,k,l,m do j=1,m,64 do k=1,m-j+1 d(k)=a(4,j-1+k) do l=1,3 b(l,k)=c(l,i)+a(l,j-1+k) end do end do call bar(b,d,i) end do end
On i686-apple-darwin9, I need -m64 to get an ICE with the test in comment #3.
This is triggered by revision 143152: http://gcc.gnu.org/ml/gcc-cvs/2009-01/msg00163.html
(In reply to comment #4) > On i686-apple-darwin9, I need -m64 to get an ICE with the test in comment #3. And if you change the types? - double precision a(4,*),b(3,64),c(3,200),d(64) + dimension a(4,*),b(3,64),c(3,200),d(64)
(In reply to comment #6) > > On i686-apple-darwin9, I need -m64 to get an ICE with the test in comment #3. > > And if you change the types? [ibook-dhum] f90/bug% gfc -c -O3 pr39595_db.f90 [ibook-dhum] f90/bug% gfc -c -m64 -O3 pr39595_db.f90 pr39595_db.f90: In function 'foo': pr39595_db.f90:3: internal compiler error: vector VEC(tree,base) index domain error, in vectorizable_store at tree-vect-stmts.c:3038
On powerpc-apple-darwin9 the code in comment #3 compiles with -m64 -O3, but ICE with the change in comment #6 with: pr39595_db.f90: In function 'foo': pr39595_db.f90:3: internal compiler error: vector VEC(tree,base) index domain error, in vectorizable_store at tree-vect-stmts.c:3038 On i686-apple-darwin9 the original code in comment #1 ICE with -O3, but not with -m64 -O3: [ibook-dhum] bug/dftgrid% gfc -c -m64 -O3 dftgrid.f [ibook-dhum] bug/dftgrid% gfc -c -O3 dftgrid.f dftgrid.f: In function 'grid_neighbour_dint': dftgrid.f:4288: internal compiler error: vector VEC(tree,base) index domain error, in vectorizable_store at tree-vect-stmts.c:3038
Will the following test do the job? (I added -m64 for target i686-*-*) ! { dg-do compile } ! { dg-options "-c -O3 -fdump-tree-vect-details -m64" { target i686-*-* } } subroutine foo(a,c,i,m) dimension a(4,*),b(3,64),c(3,200),d(64) integer*8 i,j,k,l,m do j=1,m,64 do k=1,m-j+1 d(k)=a(4,j-1+k) do l=1,3 b(l,k)=c(l,i)+a(l,j-1+k) end do end do call bar(b,d,i) end do end ! { dg-final { cleanup-tree-dump "vect" } }
No, please don't ever add -m64 or -m32 to dg-options, that is something the tester decides on in how it invokes make check. If a test is specific to -m64 or -m32, you should be using ilp32 or lp64 etc. effective target requirements, but in this case there is nothing in the testcase that requires -m64, the test just passes for some targets and fails for others. Don't add -c, that's implicit for dg-do compile, you're adding it for second time. Also, I don't like the s/double precision/dimension/ change, the type of the vars should be if possible explicit when you aren't testing the Fortran FE. On x86_64-linux it fails with double precision, but also real, integer or integer*8 instead of double precision, just don't leave the explicit type out. The testcase as is in #c3 fails on x86_64-linux and succeeds on i686-linux and RUNTESTFLAGS=--target_board=unix/-m32 on x86_64-linux, I guess on Darwin similarly, it will fail with RUNTESTFLAGS=--target_board=unix/-m64.
(In reply to comment #10) > No, please don't ever add -m64 or -m32 to dg-options, that is something the > tester decides on in how it invokes make check. If a test is specific to -m64 > or -m32, you should be using ilp32 or lp64 etc. effective target requirements, > but in this case there is nothing in the testcase that requires -m64, the test > just passes for some targets and fails for others. > Don't add -c, that's implicit for dg-do compile, you're adding it for second > time. OK, thanks for the explanation! > Also, I don't like the s/double precision/dimension/ change, the type of the > vars should be if possible explicit when you aren't testing the Fortran FE. > On x86_64-linux it fails with double precision, but also real, integer or > integer*8 instead of double precision, just don't leave the explicit type out. I will change it to real then (double does not get vectorized on PowerPC). > The testcase as is in #c3 fails on x86_64-linux and succeeds on i686-linux and > RUNTESTFLAGS=--target_board=unix/-m32 on x86_64-linux, I guess on Darwin > similarly, it will fail with RUNTESTFLAGS=--target_board=unix/-m64. Here is the final version (the test name will be O3-pr39595.f, so vect.exp will append -O3 to the flags): ! { dg-do compile } subroutine foo(a,c,i,m) real a(4,*),b(3,64),c(3,200),d(64) integer*8 i,j,k,l,m do j=1,m,64 do k=1,m-j+1 d(k)=a(4,j-1+k) do l=1,3 b(l,k)=c(l,i)+a(l,j-1+k) end do end do call bar(b,d,i) end do end ! { dg-final { cleanup-tree-dump "vect" } } Thanks, Ira
Subject: Bug 39595 Author: irar Date: Thu Apr 2 12:39:28 2009 New Revision: 145445 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=145445 Log: PR tree-optimization/39595 * tree-vect-slp.c (vect_build_slp_tree): Check that the size of interleaved loads group is not greater than the SLP group size. Added: trunk/gcc/testsuite/gfortran.dg/vect/O3-pr39595.f Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-vect-slp.c
Subject: Bug 39595 Author: irar Date: Thu Apr 2 18:08:10 2009 New Revision: 145465 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=145465 Log: PR tree-optimization/39595 * tree-vect-analyze.c (vect_build_slp_tree): Check that the size of interleaved loads group is not greater than the SLP group size. Added: branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/vect/O3-pr39595.f Modified: branches/gcc-4_4-branch/gcc/ChangeLog branches/gcc-4_4-branch/gcc/testsuite/ChangeLog branches/gcc-4_4-branch/gcc/tree-vect-analyze.c
Fixed.