Not sure whether this is in the standard or an extentions to it, but it works
with all fortran compilers I
have access to and it fails with gfortran
$ cat > bug.f <<EOF
program bug
parameter (maxdim=5)
dimension a(maxdim,maxdim)
data ((a(j,k),k=1,j),j=1,maxdim) /
+ 1, 2, 3, 4, 5, 6, 7, 8,
+ 9, 10, 11, 12, 13, 14, 15 /
character*20 fmt
*
write(fmt,'(''('',i2.2,''(1x,f5.2))'')') maxdim
do j=1,maxdim
print fmt, (a(j,k),k=1,maxdim)
enddo
end
EOF
$ gfortran -o bug bug.f
In file bug.f:4
data ((a(j,k),k=1,j),j=1,maxdim) /
1
Error: Variable 'j' at (1) cannot appear in an initialization expression
--
Summary: gfortran cannot compile data statement
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: federico dot carminati at cern dot ch
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: Darwin 8.2.0 powerpc
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24100