This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/56007] New: Remarkably bad error message with DO array=1,2
- From: "tobi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 16 Jan 2013 17:03:34 +0000
- Subject: [Bug fortran/56007] New: Remarkably bad error message with DO array=1,2
- Auto-submitted: auto-generated
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: unassigned@gcc.gnu.org
ReportedBy: tobi@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.