http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56007

--- Comment #3 from Tobias Schlüter <tobi at gcc dot gnu.org> 2013-01-22 
12:56:26 UTC ---
Just for the fun of it, another confusing way this error message appears:
$ cat t3.f90
character c(5)

do c=2,3
end do

END 
$ gfortran t3.f90
t3.f90:3.4:

do c=2,3
    1
Error: Loop variable at (1) cannot be a sub-component
t3.f90:4.3:

end do
   1
Error: Expecting END PROGRAM statement at (1)
$ 

Of course this behavior is expected once you look at the code.


Another related error message that's not really helpful:
$ cat t3.f90
real iw1(90) ! same for integer

do iw1(1)=1,2
end do

END 
$ gfortran t3.f90
t3.f90:3:

do iw1(1)=1,2
1
Error: Unclassifiable statement at (1)
t3.f90:4.3:

end do
   1
Error: Expecting END PROGRAM statement at (1)
tobi@tobias-schluters-computer src$

This latter error message is an artefact of fixed-form, where
 doiw1(90)=1,2
cannot be distinguished from an assignment to an array-valued variable (though
it could catch that the variable is not declared).

Here's a fixed-form example showing the various possibilities that involve
arrays:
$ cat t3.f
         integer iw1(90), doiw1(90)
         do iw1(1)=1,2
         end do
         do iw1(1)=1
         do iw1=1
         do iw1=1,2
         end do
         END 
$ gfortran t3.f
t3.f:2.9:

         do iw1(1)=1,2                                                  
         1
Error: Unclassifiable statement at (1)
t3.f:3.12:

         end do                                                         
            1
Error: Expecting END PROGRAM statement at (1)
t3.f:6.15:

         do iw1=1,2                                                     
               1
Error: Loop variable at (1) cannot be a sub-component
t3.f:7.12:

         end do                                                         
            1
Error: Expecting END PROGRAM statement at (1)
$

Reply via email to