[flang-commits] [PATCH] D127032: [flang][runtime] Fix deadlock in error recovery
Peter Klausler via Phabricator via flang-commits
flang-commits at lists.llvm.org
Sat Jun 4 11:02:26 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG11f928af9bfa: [flang][runtime] Fix deadlock in error recovery (authored by klausler).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127032/new/
https://reviews.llvm.org/D127032
Files:
flang/runtime/io-api.cpp
flang/runtime/io-stmt.cpp
flang/runtime/io-stmt.h
Index: flang/runtime/io-stmt.h
===================================================================
--- flang/runtime/io-stmt.h
+++ flang/runtime/io-stmt.h
@@ -711,9 +711,10 @@
class ErroneousIoStatementState : public IoStatementBase {
public:
- explicit ErroneousIoStatementState(
- Iostat iostat, const char *sourceFile = nullptr, int sourceLine = 0)
- : IoStatementBase{sourceFile, sourceLine} {
+ explicit ErroneousIoStatementState(Iostat iostat,
+ ExternalFileUnit *unit = nullptr, const char *sourceFile = nullptr,
+ int sourceLine = 0)
+ : IoStatementBase{sourceFile, sourceLine}, unit_{unit} {
SetPendingError(iostat);
}
int EndIoStatement();
@@ -722,6 +723,7 @@
private:
ConnectionState connection_;
+ ExternalFileUnit *unit_{nullptr};
};
extern template bool IoStatementState::EmitEncoded<char>(
Index: flang/runtime/io-stmt.cpp
===================================================================
--- flang/runtime/io-stmt.cpp
+++ flang/runtime/io-stmt.cpp
@@ -1520,6 +1520,9 @@
int ErroneousIoStatementState::EndIoStatement() {
SignalPendingError();
+ if (unit_) {
+ unit_->EndIoStatement();
+ }
return IoStatementBase::EndIoStatement();
}
Index: flang/runtime/io-api.cpp
===================================================================
--- flang/runtime/io-api.cpp
+++ flang/runtime/io-api.cpp
@@ -172,7 +172,7 @@
*child, sourceFile, sourceLine);
} else {
return &child->BeginIoStatement<ErroneousIoStatementState>(
- iostat, sourceFile, sourceLine);
+ iostat, nullptr /* no unit */, sourceFile, sourceLine);
}
} else {
if (iostat == IostatOk && unit.access == Access::Direct) {
@@ -186,7 +186,7 @@
std::forward<A>(xs)..., unit, sourceFile, sourceLine);
} else {
return &unit.BeginIoStatement<ErroneousIoStatementState>(
- iostat, sourceFile, sourceLine);
+ iostat, &unit, sourceFile, sourceLine);
}
}
}
@@ -228,7 +228,7 @@
*child, format, formatLength, sourceFile, sourceLine);
} else {
return &child->BeginIoStatement<ErroneousIoStatementState>(
- iostat, sourceFile, sourceLine);
+ iostat, nullptr /* no unit */, sourceFile, sourceLine);
}
} else {
if (iostat == IostatOk) {
@@ -239,7 +239,7 @@
unit, format, formatLength, sourceFile, sourceLine);
} else {
return &unit.BeginIoStatement<ErroneousIoStatementState>(
- iostat, sourceFile, sourceLine);
+ iostat, &unit, sourceFile, sourceLine);
}
}
}
@@ -280,7 +280,7 @@
*child, sourceFile, sourceLine);
} else {
return &child->BeginIoStatement<ErroneousIoStatementState>(
- iostat, sourceFile, sourceLine);
+ iostat, nullptr /* no unit */, sourceFile, sourceLine);
}
} else {
if (iostat == IostatOk) {
@@ -301,7 +301,7 @@
return &io;
} else {
return &unit.BeginIoStatement<ErroneousIoStatementState>(
- iostat, sourceFile, sourceLine);
+ iostat, &unit, sourceFile, sourceLine);
}
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127032.434278.patch
Type: text/x-patch
Size: 3127 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220604/c3eef7b0/attachment-0001.bin>
More information about the flang-commits
mailing list