consider the following program:
program matrix
implicit none
real,dimension(2,2),parameter::c=0
real,dimension(2,2)::m
m=f()+c
m=c+f()
call sub(m+f())
call sub(c+m)
call sub(f()+c)
call sub(c+f())
contains
function f()
implicit none
real, dimension(2,2)::f
f=0
end function f
subroutine sub(a)
implicit none
real, dimension(2,2)::a
end subroutine sub
end program matrix
this gives the error message:
matrix.f90: In function MAIN__:
matrix.f90:11: internal compiler error: in gfc_trans_array_constructor, at
fortran/trans-array.c:1664
though the message claims an error in line 11, the program only fails in the
presence of line 12:
"call sub(c+f())"
all the lines before (7-11) are ok.
the ICE only appears in exactly this configuration, i.e. c is a parameter, f is
a function, and c+f() is fed as an argument to a subroutine
it happens in trans-array.c(gfc_trans_array_constructor), line 1664:
/* We should have a 1-dimensional, zero-based loop. */
gcc_assert (loop->dimen == 1);
this fails with loop->dimen==2 in our case
happens only with 4.3 (trunk), but not with 4.1 or 4.2
--
Summary: [4.3 Regression] ICE in gfc_trans_array_constructor, at
fortran/trans-array.c:1664
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jaydub66 at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32682