Current trunk is ICE'ing when trying to build CPU2006 benchmark 416.gamess with -ftree-loop-linear. run/build_base_gcc_64.0001> cat junk.f SUBROUTINE GETCOF2(NP,FLM,ZLL,COEFF) C IMPLICIT DOUBLE PRECISION(A-H,O-Z) PARAMETER (MAXCOF=23821) DIMENSION COEFF(MAXCOF), * ZLL(0:2*NP+1),FLM(0:2*NP) C LENG=0 DO L=0,NP DO M=0,L DO LK=M,L LENG=LENG+1 COEFF(LENG)=FLM(L+M)*FLM(L-M)*ZLL(L-LK)/(FLM(LK+M)* * FLM(LK-M)*FLM(L-LK)*FLM(L-LK)) ENDDO ENDDO ENDDO C RETURN END run/build_base_gcc_64.0001> /home/pthaugen/install/gcc/trunk/bin/gfortran -c -O2 -ftree-loop-linear junk.f junk.f: In function 'getcof2': junk.f:1: internal compiler error: in initialize_matrix_A, at tree-data-ref.c:1885 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions.
*** Bug 37007 has been marked as a duplicate of this bug. ***
Confirmed by the dup.
Copying from the duplicate PR... The failure starts with this patch: http://gcc.gnu.org/viewcvs?view=rev&rev=135116 r135116 | spop | 2008-05-09 16:17:47 +0000 (Fri, 09 May 2008)
The ICE is because initialize_matrix_A doesn't expect to see BIT_NOT_EXPR, which is created by fold: "Convert -1 - A to ~A." and "Convert -A - 1 to ~A." cases. I've tried to handle that: @@ -1896,6 +1896,15 @@ initialize_matrix_A (lambda_matrix A, tr case INTEGER_CST: return chrec; + /* -1 - A is folded into ~A. */ + case BIT_NOT_EXPR: + { + tree op1 = initialize_matrix_A (A, TREE_OPERAND (chrec, 0), index, mult); + + return chrec_fold_op (MINUS_EXPR, chrec_type (chrec), + build_int_cst (TREE_TYPE (chrec), -1), op1); + } + default: gcc_unreachable (); return NULL_TREE; but unfortunately that doesn't get us very far. analyze_subscript_affine_affine is called with: chrec_a: {0, +, 1}_3 chrec_b: {{(integer(kind=8)) ~{0, +, 1}_2, +, 1}_1, +, -1}_3 where nb_vars_a is (probably correctly) 1, but nb_vars_b is just 2, so it tries to write to *A[3], which is uninitialized. Guess more places would need to handle BIT_NOT_EXPR, or alternatively scev needs to ensure fold doesn't fold -1 - A into ~A (or undo that folding).
Sebastian, any ideas how to fix this one?
Mine.
Subject: Re: [4.4 Regression] ICE in tree-data-ref.c with -ftree-loop-linear > Sebastian, any ideas how to fix this one? I will look at this bug.
Any news on this?
I tried the submitter's testcase on i686-pc-linux-gnu using trunk revision 143188 (today) and got the same ICE: laptop% /home/janis/tools/gcc-trunk-bid/bin/gfortran -c -O2 -ftree-loop-linear 36922.f 36922.f: In function ‘getcof2’: 36922.f:1: internal compiler error: in initialize_matrix_A, at tree-data-ref.c:1903 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. This isn't specific to powerpc.
Created attachment 17312 [details] gcc44-pr36922.patch Patch that fixes this for me. I'm going to bootstrap/regtest it now.
Subject: Bug 36922 Author: jakub Date: Tue Feb 17 23:21:23 2009 New Revision: 144250 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=144250 Log: PR tree-optimization/36922 * tree-data-ref.c (initialize_matrix_A): Handle BIT_NOT_EXPR. * tree-scalar-evolution.c (interpret_rhs_expr, instantiate_scev_1): Likewise. * gfortran.dg/pr36922.f: New test. Added: trunk/gcc/testsuite/gfortran.dg/pr36922.f Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-data-ref.c trunk/gcc/tree-scalar-evolution.c
Fixed.