public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/56007] New: Remarkably bad error message with DO array=1,2
@ 2013-01-16 17:03 tobi at gcc dot gnu.org
2013-01-16 17:12 ` [Bug fortran/56007] " dominiq at lps dot ens.fr
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: tobi at gcc dot gnu.org @ 2013-01-16 17:03 UTC (permalink / raw)
To: gcc-bugs
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/56007] Remarkably bad error message with DO array=1,2
2013-01-16 17:03 [Bug fortran/56007] New: Remarkably bad error message with DO array=1,2 tobi at gcc dot gnu.org
@ 2013-01-16 17:12 ` dominiq at lps dot ens.fr
2013-01-16 17:40 ` anlauf at gmx dot de
2013-01-22 12:56 ` tobi at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: dominiq at lps dot ens.fr @ 2013-01-16 17:12 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56007
Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2013-01-16
Ever Confirmed|0 |1
--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2013-01-16 17:11:48 UTC ---
I get the same error with gcc version 4.4.6 and trunk.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/56007] Remarkably bad error message with DO array=1,2
2013-01-16 17:03 [Bug fortran/56007] New: Remarkably bad error message with DO array=1,2 tobi at gcc dot gnu.org
2013-01-16 17:12 ` [Bug fortran/56007] " dominiq at lps dot ens.fr
@ 2013-01-16 17:40 ` anlauf at gmx dot de
2013-01-22 12:56 ` tobi at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: anlauf at gmx dot de @ 2013-01-16 17:40 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56007
Harald Anlauf <anlauf at gmx dot de> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |anlauf at gmx dot de
--- Comment #2 from Harald Anlauf <anlauf at gmx dot de> 2013-01-16 17:40:00 UTC ---
(In reply to comment #1)
> I get the same error with gcc version 4.4.6 and trunk.
It dates back to g95, so "no regression".
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/56007] Remarkably bad error message with DO array=1,2
2013-01-16 17:03 [Bug fortran/56007] New: Remarkably bad error message with DO array=1,2 tobi at gcc dot gnu.org
2013-01-16 17:12 ` [Bug fortran/56007] " dominiq at lps dot ens.fr
2013-01-16 17:40 ` anlauf at gmx dot de
@ 2013-01-22 12:56 ` tobi at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: tobi at gcc dot gnu.org @ 2013-01-22 12:56 UTC (permalink / raw)
To: gcc-bugs
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)
$
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-01-22 12:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-16 17:03 [Bug fortran/56007] New: Remarkably bad error message with DO array=1,2 tobi at gcc dot gnu.org
2013-01-16 17:12 ` [Bug fortran/56007] " dominiq at lps dot ens.fr
2013-01-16 17:40 ` anlauf at gmx dot de
2013-01-22 12:56 ` tobi at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).