[flang-commits] [PATCH] D127797: [flang][runtime] Better error message for mis-ASSIGN'ed FORMAT statement

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Tue Jun 14 14:56:13 PDT 2022


klausler updated this revision to Diff 436957.
klausler retitled this revision from "[flang] ERROR STOP is not an image control statement" to "[flang][runtime] Better error message for mis-ASSIGN'ed FORMAT statement".
klausler edited the summary of this revision.
klausler added a comment.

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.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127797/new/

https://reviews.llvm.org/D127797

Files:
  flang/runtime/format.h


Index: flang/runtime/format.h
===================================================================
--- flang/runtime/format.h
+++ flang/runtime/format.h
@@ -124,8 +124,13 @@
   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_++];


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127797.436957.patch
Type: text/x-patch
Size: 692 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220614/3b337a06/attachment.bin>


More information about the flang-commits mailing list