[flang-commits] [PATCH] D127017: [flang][runtime] Signal format error when input field width is zero

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Fri Jun 3 15:47:21 PDT 2022


klausler created this revision.
klausler added a reviewer: vdonaldson.
klausler added a project: Flang.
Herald added a subscriber: jdoerfert.
Herald added a project: All.
klausler requested review of this revision.

A data edit descriptor for input may not have a zero field width.


https://reviews.llvm.org/D127017

Files:
  flang/runtime/format-implementation.h


Index: flang/runtime/format-implementation.h
===================================================================
--- flang/runtime/format-implementation.h
+++ flang/runtime/format-implementation.h
@@ -434,6 +434,11 @@
   } else if (edit.descriptor != DataEdit::DefinedDerivedType) {
     edit.width = GetIntField(context);
   }
+  if constexpr (std::is_base_of_v<InputStatementState, CONTEXT>) {
+    if (edit.width.value_or(-1) == 0) {
+      ReportBadFormat(context, "Input field width is zero", start);
+    }
+  }
   if (edit.descriptor != DataEdit::DefinedDerivedType && PeekNext() == '.') {
     ++offset_;
     edit.digits = GetIntField(context);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127017.434175.patch
Type: text/x-patch
Size: 654 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220603/5729ffad/attachment.bin>


More information about the flang-commits mailing list