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

--- Comment #2 from Ian Harvey <ian_harvey at bigpond dot com> 2012-02-27 
09:28:22 UTC ---
There is no unit number in that /read-stmt/, just a /format/ and one io item. 
This is the "second" form (per the ordering in the syntax rules from F77 on) of
read that is the companion to the /print-stmt/ (as opposed to the more commonly
seen form that is the companion to a /write-stmt/).  This second form always
reads from the "console" (or whatever the unit * means), just like PRINT always
writes to the console.

R910
/read-stmt/ is READ ( /io-control-spec-list/ ) [ /input-item-list/ ]

            or READ /format/ [ , /input-item-list/ ]     ! <-- This one.

R915
/format/    is /default-char-expr/      ! <-- Then this one.

            or /label/

            or *

The /format/ for this /read-stmt/ is then the /default-char-expr/

  (    '('   )    //     'A)'

which has a pointlessly parenthesised character literal '(' concatenated with
'A)'.  The result of evaluating that is '(A)', which is a valid format
specification (9.6.2.2p2).

The comma is simply the comma that is required in the /read-stmt/ to separate
the format expression from the /input-item-list/.  The common vendor extension
for the extra comma for the other form of /read-stmt/ is problematic here with
respect to ambiguity.

I've used F2008 references above, but this is all standard F90 (salient parts
are F77 even?).  See c.l.f for discussion of ambiguity issues with F2008.  

I accept that this is somewhat obscure and that the specific example is rather
contrived.

Reply via email to