(j3.2006) READ unit ambiguity

Malcolm Cohen malcolm
Thu Mar 1 04:17:41 EST 2012

>       READ (unit) .op. 666, X
>The operator .op. has both unary and binary forms.  The unary form
>returns a pointer to a target variable, which the binary form
>returns a character string of type default character that has the
>form of a format.  He asked if "(unit) .op. 666" should be treated
>as a format or as an i/o control list followed by a variable.

Nice one.  In Fortran 90-2003 this is standard-conforming: (unit).op.666 is the 
unit specifier.

In Fortran 2008 we have added an ambiguous parse to the statement so by clause 1 
the program is not conforming.

That was unlucky.  We need to do something, even if that is just adding another 
incompatibility to the list in clause 1.  Other fixes are possible - e.g. 
forbidding the first item of an input-list from beginning with an operator (this 
would resolve the ambiguity in favour of maintaining backwards compatibility).

................................Malcolm Cohen, Nihon NAG, Tokyo. 

More information about the J3 mailing list