Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions flang/docs/Extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,8 @@ end
is accepted before an array specification (`ch*3(2)`) as well
as afterwards.
* A zero field width is allowed for logical formatted output (`L0`).
* `OPEN(..., FORM='BINARY')` is accepted as a legacy synonym for
the standard `OPEN(..., FORM='UNFORMATTED', ACCESS='STREAM')`.

### Extensions supported when enabled by options

Expand Down
2 changes: 1 addition & 1 deletion flang/lib/Semantics/check-io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,7 @@ void IoChecker::CheckStringValue(IoSpecKind specKind, const std::string &value,
{IoSpecKind::Decimal, {"COMMA", "POINT"}},
{IoSpecKind::Delim, {"APOSTROPHE", "NONE", "QUOTE"}},
{IoSpecKind::Encoding, {"DEFAULT", "UTF-8"}},
{IoSpecKind::Form, {"FORMATTED", "UNFORMATTED"}},
{IoSpecKind::Form, {"FORMATTED", "UNFORMATTED", "BINARY"}},
{IoSpecKind::Pad, {"NO", "YES"}},
{IoSpecKind::Position, {"APPEND", "ASIS", "REWIND"}},
{IoSpecKind::Round,
Expand Down
6 changes: 5 additions & 1 deletion flang/runtime/io-api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -887,14 +887,18 @@ bool IODEF(SetForm)(Cookie cookie, const char *keyword, std::size_t length) {
io.GetIoErrorHandler().Crash(
"SetForm() called after GetNewUnit() for an OPEN statement");
}
static const char *keywords[]{"FORMATTED", "UNFORMATTED", nullptr};
static const char *keywords[]{"FORMATTED", "UNFORMATTED", "BINARY", nullptr};
switch (IdentifyValue(keyword, length, keywords)) {
case 0:
open->set_isUnformatted(false);
break;
case 1:
open->set_isUnformatted(true);
break;
case 2: // legacy FORM='BINARY' means an unformatted stream
open->set_isUnformatted(true);
open->set_access(Access::Stream);
break;
default:
open->SignalError(IostatErrorInKeyword, "Invalid FORM='%.*s'",
static_cast<int>(length), keyword);
Expand Down
Loading