Bug 24100 - gfortran cannot compile data statement
Summary: gfortran cannot compile data statement
Status: RESOLVED DUPLICATE of bug 23232
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.1.0
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-28 07:57 UTC by Federico Carminati
Modified: 2005-09-28 13:24 UTC (History)
2 users (show)

See Also:
Host: Darwin 8.2.0 powerpc
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Federico Carminati 2005-09-28 07:57:51 UTC
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
Comment 1 Andrew Pinski 2005-09-28 13:24:00 UTC

*** This bug has been marked as a duplicate of 23232 ***