[flang-commits] [PATCH] D127022: [flang][runtime] Signal new I/O error on floating-point input overflow

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Fri Jun 3 22:55:19 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG9c54d7625116: [flang][runtime] Signal new I/O error on floating-point input overflow (authored by klausler).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D127022

Files:
  flang/include/flang/Runtime/iostat.h
  flang/runtime/edit-input.cpp
  flang/runtime/iostat.cpp


Index: flang/runtime/iostat.cpp
===================================================================
--- flang/runtime/iostat.cpp
+++ 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;
   }
Index: flang/runtime/edit-input.cpp
===================================================================
--- flang/runtime/edit-input.cpp
+++ 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;
Index: flang/include/flang/Runtime/iostat.h
===================================================================
--- flang/include/flang/Runtime/iostat.h
+++ flang/include/flang/Runtime/iostat.h
@@ -74,6 +74,7 @@
   IostatBadWaitUnit,
   IostatBOZInputOverflow,
   IostatIntegerInputOverflow,
+  IostatRealInputOverflow,
 };
 
 const char *IostatErrorString(int);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127022.434246.patch
Type: text/x-patch
Size: 1697 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220604/2b2e780b/attachment.bin>


More information about the flang-commits mailing list