[flang-commits] [flang] 690de85 - [flang][runtime] Better error message for mis-ASSIGN'ed FORMAT
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Wed Jun 15 14:46:30 PDT 2022
Author: Peter Klausler
Date: 2022-06-15T14:46:22-07:00
New Revision: 690de85ed8e953e476154ced21c9ffe12917a548
URL: https://github.com/llvm/llvm-project/commit/690de85ed8e953e476154ced21c9ffe12917a548
DIFF: https://github.com/llvm/llvm-project/commit/690de85ed8e953e476154ced21c9ffe12917a548.diff
LOG: [flang][runtime] Better error message for mis-ASSIGN'ed FORMAT
When an I/O data transfer statement uses an ASSIGN'ed FORMAT that
has not been ASSIGN'ed to a FORMAT statement, the runtime receives
a zero-length format string. Distinguish this case from the general
error message about missing parentheses.
Differential Revision: https://reviews.llvm.org/D127797
Added:
Modified:
flang/runtime/format.h
Removed:
################################################################################
diff --git a/flang/runtime/format.h b/flang/runtime/format.h
index 56aa86bbe97c..40a0f30f9940 100644
--- a/flang/runtime/format.h
+++ b/flang/runtime/format.h
@@ -124,8 +124,13 @@ template <typename CONTEXT> class FormatControl {
CharType GetNextChar(IoErrorHandler &handler) {
SkipBlanks();
if (offset_ >= formatLength_) {
- handler.SignalError(
- IostatErrorInFormat, "FORMAT missing at least one ')'");
+ if (formatLength_ == 0) {
+ handler.SignalError(
+ IostatErrorInFormat, "Empty or badly assigned FORMAT");
+ } else {
+ handler.SignalError(
+ IostatErrorInFormat, "FORMAT missing at least one ')'");
+ }
return '\n';
}
return format_[offset_++];
More information about the flang-commits
mailing list