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



             Bug #: 56007

           Summary: Remarkably bad error message with DO array=1,2

    Classification: Unclassified

           Product: gcc

           Version: 4.7.2

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: fortran

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: t...@gcc.gnu.org





$ cat t3.f90

real iw1(90)

do iw1=1,2

end do

END 

$ gfortran t3.f90

t3.f90:2.6:



do iw1=1,2

      1

Error: Loop variable at (1) cannot be a sub-component

t3.f90:3.3:



end do

   1

Error: Expecting END PROGRAM statement at (1)

$ 



match.c has the following check in gfc_match_iterator:

  if (var->ref != NULL)

    {

      gfc_error ("Loop variable at %C cannot be a sub-component");

      goto cleanup;

    }

This assumes that all ref's are component ref's.  I verified that the bug

happens with 4.7.2, but looking at the code I would assume that this also

happens with the trunk.



This error message was mildly confusing, as I ran into this in a Fortran 77

codebase where there are no components.

Reply via email to