GCC trunk gets an internal compiler error when building SPEC CPU2000 test 200.sixtrack with "-O2 -floop-parallelize-all -fprefetch-loops-arrays" on powerpc-linux, as demonstrated by this minimized testcase: subroutine phasad(t,i,ium) implicit none real t(5,4) integer i,l,ll,ium do l=1,2 ll=2*l do i=1,ium t(i,ll-1)=t(i,ll-1)+t(i,ll) enddo enddo return end elm3b149% /home/janis/tools/gcc-trunk-anonsvn/bin/gfortran -c -O2 -floop-parallelize-all -fprefetch-loop-arrays bug.f bug.f: In function ‘phasad’: bug.f:1:0: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. The failure has existed since the large Graphite merge that introduced -fgraphite-force-parallel which was later renamed to -floop-parallelize-all. The segmentation fault occurs in initialize_matrix_A at tree-data-ref.c:1914 when A[index] has the value (lambda_vector) 0xa.
This testcase minimized from 173.applu fails in the same place when compiled with "-m32 -O2 floop-strip-mine -fprefetch-loop-arrays" on powerpc64-linux. subroutine blts ( ldmx, ldmy, v, tmp1, i, j, k) implicit none integer ldmx, ldmy, i, j, k, ip, m, l real*8 tmp, tmp1, v( 5, ldmx, ldmy, *), tmat(5,5) do ip = 1, 4 do m = ip+1, 5 tmp = tmp1 * tmat( m, ip ) do l = ip+1, 5 tmat( m, l ) = tmat( m, l ) - tmat( ip, l ) end do v( m, i, j, k ) = tmp end do end do return end
Mine.
I cannot reproduce this bug (both testcases) on amd64-linux on trunk revision 155219. Could you please try again to see if this has been resolved? Thanks, Sebastian
I see it for both reduced tests on powerpc-apple-darwin9, revision 155196, in 32 bit mode, but not in the 64 bit one. The compilation goes fine on x86_64-apple-darwin10, revision 155224.
I can reproduce it with the testcase in comment #1 on i?86-linux: $ ./f951 -quiet t.f -O2 -floop-strip-mine -fprefetch-loop-arrays -msse2 t.f: In function 'blts': t.f:1:0: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. Program received signal SIGSEGV, Segmentation fault. 0x086197d5 in initialize_matrix_A (A=0xb778ecb0, chrec=0xb77d36e4, index=2, mult=-1) at /home/richard/src/trunk/gcc/tree-data-ref.c:1914 1914 A[index][0] = mult * int_cst_value (CHREC_RIGHT (chrec)); (gdb) p A[index] $4 = (lambda_vector) 0x6
Works for me with 4.4.2 on i?86-linux.
I still see both failures with -m32 on powerpc64-linux but not with -m64.
With today's trunk both testcases fail with -m32 but not -m64. sixtrack builds, but not applu.
The following Lagrange interpolation routine crashes the trunk > gcc -O1 -floop-parallelize-all -c bug.c bug.c: In function ‘lagrange’: bug.c:1:8: internal compiler error: Segmentation fault ... etc. > gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/home/common/compilers/gcc450/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.5.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../gcc-mainline/configure --prefix=/usr/local/gcc450 --enable-languages=c,c++,fortran Thread model: posix gcc version 4.5.0 20100226 (experimental) (GCC) This is r157083 of the trunk. > cat bug.c double lagrange(const double x[], const double y[], long n, double xval) { long i, j; double yval = 0.; for( i=0; i < n; i++ ) { double l = 1.; for( j=0; j < n; j++ ) if( i != j ) l *= (xval-x[j])/(x[i]-x[j]); yval += y[i]*l; } return yval; } The same problem?
Comment #9 is not the same as the original reported bug. I have a fix for #9. Sebastian
Subject: Bug 42326 Author: spop Date: Tue Mar 2 11:51:21 2010 New Revision: 157162 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=157162 Log: Fix PR42326: handle default definitions. 2010-03-02 Sebastian Pop <sebastian.pop@amd.com> PR middle-end/42326 * sese.c (name_defined_in_loop_p): Return false for default definitions. * gcc.dg/graphite/pr42326.c: New. Added: branches/graphite/gcc/testsuite/gcc.dg/graphite/pr42326.c Modified: branches/graphite/gcc/ChangeLog.graphite branches/graphite/gcc/sese.c
We are building scalar evolutions that have no defined semantics: the initial value is variating in an inner loop. {(2 + (integer(kind=4)) {0, +, 1}_5) * 5 + ((2 + (integer(kind=4)) {0, +, 1}_4) + -6), +, 6}_1 and {(2 + (integer(kind=4)) {0, +, 1}_5) * 5 + -5, +, 6}_1 in the following loop nest: (gdb) p debug_loops (1) loop_0 (header = 0, latch = 1, niter = ) { loop_1 (header = 3, latch = 14, niter = , upper_bound = 4, estimate = 4) { loop_4 (header = 6, latch = 11, niter = , upper_bound = 4294967296) { loop_5 (header = 8, latch = 9, niter = D.1652_117, upper_bound = 4294967296) { } } } }
We build these scevs because chrec_fold_multiply and chrec_fold_plus do not correctly handle conversions: op0 = (integer(kind=4)) {0, +, 1}_4 is considered non variating in any loop, and thus when op0 gets added to op1 = {0, +, 1}_1, the result is: {(integer(kind=4)) {0, +, 1}_4, +, 1}_1 that has no defined semantics.
Patch at http://gcc.gnu.org/ml/gcc-patches/2010-03/msg00237.html
Subject: Bug 42326 Author: spop Date: Fri Mar 5 20:37:44 2010 New Revision: 157244 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=157244 Log: Fix PR42326: Handle more carefully convert expressions in chrec_fold_plus and chrec_fold_mult. 2010-03-05 Sebastian Pop <sebastian.pop@amd.com> PR middle-end/42326 * tree-chrec.c (chrec_fold_plus_1): Do not handle convert expressions that contain scevs. (chrec_fold_multiply): Same. * gfortran.dg/graphite/pr42326.f90: New. * gfortran.dg/graphite/pr42326-1.f90: New. Added: trunk/gcc/testsuite/gfortran.dg/graphite/pr42326-1.f90 trunk/gcc/testsuite/gfortran.dg/graphite/pr42326.f90 Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-chrec.c
Fixed.
The test case in comment #9 has only been fixed on the graphite branch, but still crashes on the trunk as of r157255. Please reopen and fix this problem on the trunk.
Confirmed. This patch: Fix PR42326: handle default definitions. 2010-03-02 Sebastian Pop <sebastian.pop@amd.com> PR middle-end/42326 * sese.c (name_defined_in_loop_p): Return false for default definitions. * gcc.dg/graphite/pr42326.c: New. Added: branches/graphite/gcc/testsuite/gcc.dg/graphite/pr42326.c Modified: branches/graphite/gcc/ChangeLog.graphite branches/graphite/gcc/sese.c isn't in trunk.
Subject: Bug 42326 Author: spop Date: Mon Mar 8 17:48:55 2010 New Revision: 157280 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=157280 Log: Fix PR42326: handle default definitions. 2010-03-02 Sebastian Pop <sebastian.pop@amd.com> PR middle-end/42326 * sese.c (name_defined_in_loop_p): Return false for default definitions. * gcc.dg/graphite/pr42326.c: New. Added: trunk/gcc/testsuite/gcc.dg/graphite/pr42326.c Modified: trunk/gcc/ChangeLog.graphite trunk/gcc/sese.c
Fixed now the second unrelated bug reported within this PR.