forked from OSchip/llvm-project
[flang] Correct implementation of WAIT with no ID
Previous one was returning a bogus error status about a bad WAIT statement ID number. Differential Revision: https://reviews.llvm.org/D127979
This commit is contained in:
parent
5bcda1d3a9
commit
17853928a6
|
@ -400,7 +400,7 @@ Cookie IONAME(BeginWait)(ExternalUnit unitNumber, AsynchronousId id,
|
|||
}
|
||||
Cookie IONAME(BeginWaitAll)(
|
||||
ExternalUnit unitNumber, const char *sourceFile, int sourceLine) {
|
||||
return IONAME(BeginWait)(unitNumber, 0 /*no ID=*/);
|
||||
return IONAME(BeginWait)(unitNumber, 0 /*no ID=*/, sourceFile, sourceLine);
|
||||
}
|
||||
|
||||
Cookie IONAME(BeginClose)(
|
||||
|
|
|
@ -918,11 +918,13 @@ int ExternalFileUnit::GetAsynchronousId(IoErrorHandler &handler) {
|
|||
}
|
||||
|
||||
bool ExternalFileUnit::Wait(int id) {
|
||||
if (id < 0 || asyncIdAvailable_.test(id)) {
|
||||
if (static_cast<std::size_t>(id) >= asyncIdAvailable_.size() ||
|
||||
asyncIdAvailable_.test(id)) {
|
||||
return false;
|
||||
} else {
|
||||
if (id == 0) {
|
||||
if (id == 0) { // means "all IDs"
|
||||
asyncIdAvailable_.set();
|
||||
asyncIdAvailable_.reset(0);
|
||||
} else {
|
||||
asyncIdAvailable_.set(id);
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ public:
|
|||
explicit ExternalFileUnit(int unitNumber) : unitNumber_{unitNumber} {
|
||||
isUTF8 = executionEnvironment.defaultUTF8;
|
||||
asyncIdAvailable_.set();
|
||||
asyncIdAvailable_.reset(0);
|
||||
}
|
||||
~ExternalFileUnit() {}
|
||||
|
||||
|
|
Loading…
Reference in New Issue