/gcc/spec/sb-balakirew-head-64-2006/x86_64/install-hack/bin/gfortran -c -o nmr.fppized.o -O2 -DSPEC_CPU_LP64 -ffixed-form nmr.fppized.f nmr.fppized.f: In function 'oneints': nmr.fppized.f:617: internal compiler error: in build2_stat, at tree.c:3074 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Created attachment 13741 [details] testcase Testcase that fails with -O2 -ffixed-form
#0 fancy_abort ( file=0xe87fc8 "/space/rguenther/src/svn/pointer_plus/gcc/tree.c", line=3074, function=0xe893df "build2_stat") at /space/rguenther/src/svn/pointer_plus/gcc/diagnostic.c:656 #1 0x0000000000a28c7e in build2_stat (code=MULT_EXPR, tt=0x2ab8fd777600, arg0=0x2ab8fe1bc8c0, arg1=0x2ab8fe1acb70) at /space/rguenther/src/svn/pointer_plus/gcc/tree.c:3074 #2 0x00000000006b4c2b in fold_build2_stat (code=MULT_EXPR, type=0x2ab8fd777600, op0=0x2ab8fe1bc8c0, op1=0x2ab8fe1acb70) at /space/rguenther/src/svn/pointer_plus/gcc/fold-const.c:12943 #3 0x0000000000d5df39 in aff_combination_add_elt (comb=0x7fffad3af9f0, elt=0x2ab8fe137840, scale={low = 4, high = 0}) at /space/rguenther/src/svn/pointer_plus/gcc/tree-affine.c:175
Reduced testcase: SUBROUTINE ONEINTS() COMMON /INFOA / NAT,NUM DIMENSION TINT(NUM*NUM,NAT,3,3,3),TINTM(NUM,NUM,NAT,3,3,3) CALL TINTS(IC) DO ID=1,3 DO IC=1,NAT TINTM(J,I,IC,IAN,INU,ID) = TINT((I-1)*NUM+J,IC,IAN,INU,ID) ENDDO ENDDO END
Here is the patch which fixes this testcase (note IV-OPTS is still messed up but I will work on that later): Index: tree-affine.c =================================================================== --- tree-affine.c (revision 125927) +++ tree-affine.c (working copy) @@ -130,6 +130,7 @@ aff_combination_add_elt (aff_tree *comb, tree elt, double_int scale) { unsigned i; + tree type; scale = double_int_ext_for_comb (scale, comb); if (double_int_zero_p (scale)) @@ -169,17 +170,26 @@ return; } + type = comb->type; + if (POINTER_TYPE_P (type)) + type = sizetype; + if (double_int_one_p (scale)) - elt = fold_convert (comb->type, elt); + elt = fold_convert (type, elt); else - elt = fold_build2 (MULT_EXPR, comb->type, - fold_convert (comb->type, elt), - double_int_to_tree (comb->type, scale)); + elt = fold_build2 (MULT_EXPR, type, + fold_convert (type, elt), + double_int_to_tree (type, scale)); if (comb->rest) - comb->rest = fold_build2 (PLUS_EXPR, comb->type, comb->rest, elt); + { + if (!POINTER_TYPE_P (comb->type)) + comb->rest = fold_build2 (PLUS_EXPR, comb->type, comb->rest, elt); + else + comb->rest = fold_build2 (POINTER_PLUS_EXPR, comb->type, comb->rest, elt); + } else - comb->rest = elt; + comb->rest = fold_convert (comb->type, elt); } /* Adds CST to C. */
*** Bug 32459 has been marked as a duplicate of this bug. ***
*** Bug 32478 has been marked as a duplicate of this bug. ***
Patch testing right now.
Subject: Bug 32417 Author: pinskia Date: Thu Jun 28 19:03:49 2007 New Revision: 126082 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=126082 Log: 2007-06-28 Andrew Pinski <andrew_pinski@playstation.sony.com> PR tree-opt/32417 * tree-affine.c (aff_combination_add_elt): Handle pointer addition specially. 2007-06-28 Andrew Pinski <andrew_pinski@playstation.sony.com> PR tree-opt/32417 * gfortran.fortran-torture/compile/pr32417.f90: New test. Added: trunk/gcc/testsuite/gfortran.fortran-torture/compile/pr32417.f90 Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-affine.c
Fixed.
The testcase still fails for me at -O2. ./f951 -quiet -O2 nmr.min.f nmr.min.f: In function 'oneints': nmr.min.f:1: internal compiler error: in build2_stat, at tree.c:3074 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions.
In fact I see FAIL: gfortran.fortran-torture/compile/pr32417.f90, "-O" (internal compiler error) on i686-pc-linux-gnu.
One note, when I was originally fixing this bug, the test worked but now it fails at -O1. I guess the new VN exposed the new problem.
Ok, the problem at -O1 is really PR 32527. So I am closing this as a dup of that bug. *** This bug has been marked as a duplicate of 32527 ***
Subject: Re: [4.3 Regression] 416.gamess ICEs (in aff_combination_add_elt, tree-affine.c) On Tue, 2 Jul 2007, pinskia at gcc dot gnu dot org wrote: > ------- Comment #12 from pinskia at gcc dot gnu dot org 2007-07-02 23:58 ------- > One note, when I was originally fixing this bug, the test worked but now it > fails at -O1. I guess the new VN exposed the new problem. gamess didn't get back to working, but maybe the reduced testcase was indeed fixed for some time. Richard.