forked from OSchip/llvm-project
[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
This commit is contained in:
parent
e5a4f730da
commit
aa77cf90aa
|
@ -434,6 +434,11 @@ DataEdit FormatControl<CONTEXT>::GetNextDataEdit(
|
||||||
} else if (edit.descriptor != DataEdit::DefinedDerivedType) {
|
} else if (edit.descriptor != DataEdit::DefinedDerivedType) {
|
||||||
edit.width = GetIntField(context);
|
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() == '.') {
|
if (edit.descriptor != DataEdit::DefinedDerivedType && PeekNext() == '.') {
|
||||||
++offset_;
|
++offset_;
|
||||||
edit.digits = GetIntField(context);
|
edit.digits = GetIntField(context);
|
||||||
|
|
Loading…
Reference in New Issue