[PATCH] D112346: [flang] Support legacy usage of 'A' edit descriptors for integer & real

Peter Klausler via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 22 16:04:55 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb83242e20e09: [flang] Support legacy usage of 'A' edit descriptors for integer & real (authored by klausler).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112346

Files:
  flang/runtime/edit-input.cpp
  flang/runtime/edit-output.cpp
  flang/unittests/Runtime/RuntimeCrashTest.cpp


Index: flang/unittests/Runtime/RuntimeCrashTest.cpp
===================================================================
--- flang/unittests/Runtime/RuntimeCrashTest.cpp
+++ flang/unittests/Runtime/RuntimeCrashTest.cpp
@@ -57,8 +57,8 @@
   static const char *format{"(A4)"};
   auto *cookie{IONAME(BeginInternalFormattedOutput)(
       buffer, bufferSize, format, std::strlen(format))};
-  ASSERT_DEATH(IONAME(OutputInteger64)(cookie, 0xfeedface),
-      "Data edit descriptor 'A' may not be used with an INTEGER data item");
+  ASSERT_DEATH(IONAME(OutputLogical)(cookie, true),
+      "Data edit descriptor 'A' may not be used with a LOGICAL data item");
 }
 
 TEST(TestIOCrash, InvalidFormatCharacterTest) {
Index: flang/runtime/edit-output.cpp
===================================================================
--- flang/runtime/edit-output.cpp
+++ flang/runtime/edit-output.cpp
@@ -52,6 +52,9 @@
       *--p = digit >= 10 ? 'A' + (digit - 10) : '0' + digit;
     }
     break;
+  case 'A': // legacy extension
+    return EditDefaultCharacterOutput(
+        io, edit, reinterpret_cast<char *>(&n), sizeof n);
   default:
     io.GetIoErrorHandler().Crash(
         "Data edit descriptor '%c' may not be used with an INTEGER data item",
@@ -402,6 +405,9 @@
             decimal::BinaryFloatingPointNumber<binaryPrecision>{x_}.raw()));
   case 'G':
     return Edit(EditForGOutput(edit));
+  case 'A': // legacy extension
+    return EditDefaultCharacterOutput(
+        io_, edit, reinterpret_cast<char *>(&x_), sizeof x_);
   default:
     if (edit.IsListDirected()) {
       return EditListDirectedOutput(edit);
Index: flang/runtime/edit-input.cpp
===================================================================
--- flang/runtime/edit-input.cpp
+++ flang/runtime/edit-input.cpp
@@ -83,6 +83,9 @@
     return EditBOZInput(io, edit, n, 8, kind << 3);
   case 'Z':
     return EditBOZInput(io, edit, n, 16, kind << 3);
+  case 'A': // legacy extension
+    return EditDefaultCharacterInput(
+        io, edit, reinterpret_cast<char *>(n), kind);
   default:
     io.GetIoErrorHandler().SignalError(IostatErrorInFormat,
         "Data edit descriptor '%c' may not be used with an INTEGER data item",
@@ -323,6 +326,9 @@
   case 'Z':
     return EditBOZInput(
         io, edit, n, 16, common::BitsForBinaryPrecision(binaryPrecision));
+  case 'A': // legacy extension
+    return EditDefaultCharacterInput(
+        io, edit, reinterpret_cast<char *>(n), KIND);
   default:
     io.GetIoErrorHandler().SignalError(IostatErrorInFormat,
         "Data edit descriptor '%c' may not be used for REAL input",


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112346.381679.patch
Type: text/x-patch
Size: 2610 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211022/0200bef9/attachment.bin>


More information about the llvm-commits mailing list