Skip to content

[flang][runtime] Don't crash on ASYNCHRONOUS='NO' in child I/O #124208

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 27, 2025
Merged
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
16 changes: 8 additions & 8 deletions flang/runtime/io-api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -770,18 +770,18 @@ bool IODEF(SetAsynchronous)(
"SetAsynchronous() called after GetNewUnit() for an OPEN statement");
}
open->unit().set_mayAsynchronous(isYes);
} else if (!isYes) {
// ASYNCHRONOUS='NO' is the default, so this is a no-op
} else if (auto *ext{io.get_if<ExternalIoStatementBase>()}) {
if (isYes) {
if (ext->unit().mayAsynchronous()) {
ext->SetAsynchronous();
} else {
handler.SignalError(IostatBadAsynchronous);
}
if (ext->unit().mayAsynchronous()) {
ext->SetAsynchronous();
} else {
handler.SignalError(IostatBadAsynchronous);
}
} else if (!io.get_if<NoopStatementState>() &&
!io.get_if<ErroneousIoStatementState>()) {
handler.Crash("SetAsynchronous() called when not in an OPEN or external "
"I/O statement");
handler.Crash("SetAsynchronous('YES') called when not in an OPEN or "
"external I/O statement");
}
return !handler.InError();
}
Expand Down
Loading