[flang] Set default form if unspecified at end of OPEN statement
authorJean Perier <jperier@nvidia.com>
Wed, 1 Sep 2021 06:39:39 +0000 (08:39 +0200)
committerJean Perier <jperier@nvidia.com>
Wed, 1 Sep 2021 06:40:43 +0000 (08:40 +0200)
commitc5729f2e638a792759a53c28fbe39a22ede86943
tree845057d62bd7fa11afd4a73f570b836c96c2c0cd
parenta78dd726f46de63529585b2569314d35ce39105d
[flang] Set default form if unspecified at end of OPEN statement

The standard specifies that the form must be set to a default at the
end of an open statement (C.7.4 point 2) where it was not specified.
Only in the case of a pre-connected unit can the form be deferred
until the first data transfer statement.

Set back the default form setting in OpenStatementState::EndIoStatement
that had been removed when deferring the pre-connected unit from setting
in 199a623ebf808a01e920ebd9904c99e633c33a1f.

Also return "UNDEFINED" instead of "UNKNOWN" to the FORM inquiry when the
form was not yet specified as defined in 12.10.2.12.

Related test: syntax 215a216.

Differential Revision: https://reviews.llvm.org/D108990
flang/runtime/io-stmt.cpp