This is GCC Bugzilla
This is GCC Bugzilla Version 2.20+
View Bug Activity | Format For Printing | Clone This Bug
This bug was encountered using the precompiled biaries recently uploaded to Sourceforge. "Internal compiler error" occurs in following code: program testg real, dimension(5) :: a real, dimension(3) :: b a=(/ 1.5,2.1,3.2,4.6,5.3 /) b=a((/ 2,3,1 /)) !fails print *, b end
Confirmed with tree-ssa gfortran 20030925: f951: ../../gcc/gcc/fortran/trans-array.c:1076: gfc_conv_ss_descriptor: Assertion ss->expr->expr_type == EXPR_VARIABLE failed. 12366.f95: In function `MAIN__': 12366.f95:5: internal compiler error: Aborted. Toon Moene
The current tree seems to ignore the assignment which failed before. I'll see if I can find out what's happening. Compiler output below: [tobi@marktplatz src]$ gcc/build/gcc/f951 testg.f90 -fdump-parse-tree Namespace: A-H: (REAL 4) I-N: (INTEGER 4) O-Z: (REAL 4) symtree: a Ambig 0 symbol a (REAL 4)(VARIABLE UNKNOWN-INTENT UNKNOWN-ACCESS UNKNOWN-PROC DIMENSION) Array spec:(1 AS_EXPLICIT 1 5 ) symtree: b Ambig 0 symbol b (REAL 4)(VARIABLE UNKNOWN-INTENT UNKNOWN-ACCESS UNKNOWN-PROC DIMENSION) Array spec:(1 AS_EXPLICIT 1 3 ) symtree: testg Ambig 0 symbol testg (UNKNOWN 0)(PROGRAM UNKNOWN-INTENT UNKNOWN-ACCESS UNKNOWN-PROC) ASSIGN a(FULL) (/ 0.15e1 , 0.21e1 , 0.32e1 , 0.46e1 , 0.53e1 /) WRITE UNIT=6 FMT=-1 TRANSFER b(FULL) DT_END MAIN__ Execution times (seconds) life analysis : 0.00 ( 0%) usr 0.00 ( 0%) sys 0.01 (20%) wall parser : 0.01 (20%) usr 0.00 ( 0%) sys 0.01 (20%) wall expand : 0.01 (20%) usr 0.00 ( 0%) sys 0.00 ( 0%) wall TOTAL : 0.05 0.00 0.05 Extra diagnostic checks enabled; compiler may run slowly. Configure with --disable-checking to disable checks. [tobi@marktplatz src]$
(In reply to comment #2) > The current tree seems to ignore the assignment which failed before. I'll see if Looks like I had messed up the testcase. Seems like even cut'n'paste ain't foolproof. What is happening is this: [tobi@marktplatz tests]$ gfortran pr12366.f90 -fdump-parse-tree Namespace: A-H: (REAL 4) I-N: (INTEGER 4) O-Z: (REAL 4) symtree: a Ambig 0 symbol a (REAL 4)(VARIABLE UNKNOWN-INTENT UNKNOWN-ACCESS UNKNOWN-PROC DIMENSION) Array spec:(1 AS_EXPLICIT 1 5 ) symtree: b Ambig 0 symbol b (REAL 4)(VARIABLE UNKNOWN-INTENT UNKNOWN-ACCESS UNKNOWN-PROC DIMENSION) Array spec:(1 AS_EXPLICIT 1 3 ) symtree: testg Ambig 0 symbol testg (UNKNOWN 0)(PROGRAM UNKNOWN-INTENT UNKNOWN-ACCESS UNKNOWN-PROC) ASSIGN a(FULL) (/ 0.15e1 , 0.21e1 , 0.32e1 , 0.46e1 , 0.53e1 /) ASSIGN b(FULL) a((/ 2 , 3 , 1 /):) WRITE UNIT=6 FMT=-1 TRANSFER b(FULL) DT_END f951: ../../gcc/gcc/fortran/trans-array.c:1067: gfc_conv_ss_descriptor: Assertion `ss->expr->expr_type == EXPR_VARIABLE' failed. pr12366.f90: In function `MAIN__': pr12366.f90:5: internal compiler error: Aborted Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. [tobi@marktplatz tests]$ Note the assignment to b: ASSIGN b(FULL) a((/ 2 , 3 , 1 /):) ^ this is probably our bug An array index of the form (/.../) should not be matched as an open-ended range. (It could also be that the parse-tree dumper is at fault, and the problem is somewhere else.) I'll see if can cook up a patch.
(In reply to comment #3) > Note the assignment to b: > ASSIGN b(FULL) a((/ 2 , 3 , 1 /):) > ^ this is probably our bug > > An array index of the form (/.../) should not be matched as an open-ended range. > (It could also be that the parse-tree dumper is at fault, and the problem is > somewhere else.) I'll see if can cook up a patch. That was the result of an omission in the dumper. So no, I can't cook up a patch.
*** Bug 15961 has been marked as a duplicate of this bug. ***
*** Bug 17847 has been marked as a duplicate of this bug. ***
*** Bug 17899 has been marked as a duplicate of this bug. ***
*** Bug 18379 has been marked as a duplicate of this bug. ***
For what it is worth: program testg real, dimension(5) :: a=(/ 1.5,2.1,3.2,4.6,5.3 /) integer,dimension(3) :: i i=(/ 2,3,1 /) print *, a((/ 2,3,1 /)) ! ICEs ! print *, a(i) !works fine end
*** Bug 18955 has been marked as a duplicate of this bug. ***
*** Bug 20651 has been marked as a duplicate of this bug. ***
*** Bug 20686 has been marked as a duplicate of this bug. ***
Fixed for 4.1.0 and above. I did not try 4.0.2 though.
This is not fixed in 4.0.2: $ cat pr12366.f90 program testg real, dimension(5) :: a=(/ 1.5,2.1,3.2,4.6,5.3 /) integer,dimension(3) :: i i=(/ 2,3,1 /) print *, a((/ 2,3,1 /)) ! ICEs ! print *, a(i) !works fine end program testg $ gfortran pr12366.f90 pr12366.f90: In function 'MAIN__': pr12366.f90:5: internal compiler error: in gfc_conv_ss_descriptor, at fortran/trans-array.c:1235 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. $ gfortran -v Using built-in specs. Target: i686-pc-linux-gnu Configured with: ../gcc-4.0/configure --prefix=/home/ig25 --enable-languages=c,fortran Thread model: posix gcc version 4.0.2 20050917 (prerelease)
All of these are fixed in 4.1.0. Since 4.0.2 is the last 4.0 release before a 4.1.0 release will be made, 4.0.2 and 4.0.1 were special releases for gfrotran. 4.0.3 should be a normal release for GCC and gfortran in that regressions are the only changes.