User account creation filtered due to spam.

Bug 24100

Summary: gfortran cannot compile data statement
Product: gcc Reporter: Federico Carminati <federico.carminati>
Component: fortranAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED DUPLICATE    
Severity: normal CC: alfredo.ferrari, gcc-bugs
Priority: P2    
Version: 4.1.0   
Target Milestone: ---   
Host: Darwin 8.2.0 powerpc Target:
Build: Known to work:
Known to fail: Last reconfirmed:

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 ***