[flang-commits] [flang] aa77cf9 - [flang][runtime] Signal format error when input field width is zero
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Fri Jun 3 18:14:23 PDT 2022
Author: Peter Klausler
Date: 2022-06-03T18:11:00-07:00
New Revision: aa77cf90aab8f47f748ae9594321c30095fbf9f5
URL: https://github.com/llvm/llvm-project/commit/aa77cf90aab8f47f748ae9594321c30095fbf9f5
DIFF: https://github.com/llvm/llvm-project/commit/aa77cf90aab8f47f748ae9594321c30095fbf9f5.diff
LOG: [flang][runtime] Signal format error when input field width is zero
A data edit descriptor for input may not have a zero field width.
Differential Revision: https://reviews.llvm.org/D127017
Added:
Modified:
flang/runtime/format-implementation.h
Removed:
################################################################################
diff --git a/flang/runtime/format-implementation.h b/flang/runtime/format-implementation.h
index ab2fad3188bd..cec51d8d957e 100644
--- a/flang/runtime/format-implementation.h
+++ b/flang/runtime/format-implementation.h
@@ -434,6 +434,11 @@ DataEdit FormatControl<CONTEXT>::GetNextDataEdit(
} 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);
More information about the flang-commits
mailing list