diff --git a/flang/include/flang/Runtime/iostat.h b/flang/include/flang/Runtime/iostat.h --- a/flang/include/flang/Runtime/iostat.h +++ b/flang/include/flang/Runtime/iostat.h @@ -74,6 +74,7 @@ IostatBadWaitUnit, IostatBOZInputOverflow, IostatIntegerInputOverflow, + IostatRealInputOverflow, }; const char *IostatErrorString(int); diff --git a/flang/runtime/edit-input.cpp b/flang/runtime/edit-input.cpp --- a/flang/runtime/edit-input.cpp +++ b/flang/runtime/edit-input.cpp @@ -428,6 +428,9 @@ io.HandleRelativePosition(p - str); // Set FP exception flags if (converted.flags != decimal::ConversionResultFlags::Exact) { + if (converted.flags & decimal::ConversionResultFlags::Overflow) { + return false; // let slow path deal with it + } RaiseFPExceptions(converted.flags); } return true; @@ -505,6 +508,10 @@ converted.binary; // Set FP exception flags if (converted.flags != decimal::ConversionResultFlags::Exact) { + if (converted.flags & decimal::ConversionResultFlags::Overflow) { + io.GetIoErrorHandler().SignalError(IostatRealInputOverflow); + return false; + } RaiseFPExceptions(converted.flags); } return true; diff --git a/flang/runtime/iostat.cpp b/flang/runtime/iostat.cpp --- a/flang/runtime/iostat.cpp +++ b/flang/runtime/iostat.cpp @@ -92,6 +92,8 @@ return "B/O/Z input value overflows variable"; case IostatIntegerInputOverflow: return "Integer input value overflows variable"; + case IostatRealInputOverflow: + return "Real or complex input value overflows type"; default: return nullptr; }