This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/33269] Diagnose missing "(" in "PRINT ('a'),"
- From: "burnus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 31 Aug 2007 20:02:06 -0000
- Subject: [Bug fortran/33269] Diagnose missing "(" in "PRINT ('a'),"
- References: <bug-33269-13404@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from burnus at gcc dot gnu dot org 2007-08-31 20:02 -------
> gfortran does catch these at run time.
Well, at compile time is nicer ;-)
> Also, the last case, read ('f3.3'), a, does give a legitimate error:
> read ('f3.3'), a
> 1
> Error: UNIT specification at (1) must be an INTEGER expression or a CHARACTER
> variable.
No, the syntax is:
READ format[, io-list]
and ('f.3.3') as a constant-string expression for the format; this is similar
to "PRINT ('f3.3'), a".
This should be distinguished from:
READ(io-control-spec-list)
The distinction is simple: If there is no ( and an * or a label, it must be
"READ format"; if the first item after the "(" is a default-char-expression
(constant or not) and there is no "...=" (e.g. "fmt=") in there, then it is
also a "READ format" statement.
> See PR28397. I think this is a near duplicate.
Yes and no. This PR is about things which are in principle correctly diagnosed,
but not if one surrounds it with parenthesis. The other PR is about things
which should be diagnosed but are not. They are related, but they need
different fixes.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33269