[flang-commits] [flang] 6fd475f - [flang][runtime] 'A' output editing for LOGICAL (#89817)

via flang-commits flang-commits at lists.llvm.org
Wed Apr 24 15:32:50 PDT 2024


Author: Peter Klausler
Date: 2024-04-24T15:32:48-07:00
New Revision: 6fd475fe2e7b15a6f6344430d02c454cf8928a35

URL: https://github.com/llvm/llvm-project/commit/6fd475fe2e7b15a6f6344430d02c454cf8928a35
DIFF: https://github.com/llvm/llvm-project/commit/6fd475fe2e7b15a6f6344430d02c454cf8928a35.diff

LOG: [flang][runtime] 'A' output editing for LOGICAL (#89817)

We support 'A' output editing for INTEGER and REAL as an extension; it
turns out to be used as well for LOGICAL in application code.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/flang/runtime/edit-output.cpp b/flang/runtime/edit-output.cpp
index a06ed258f0f1d2..c3e11e6e4ce6de 100644
--- a/flang/runtime/edit-output.cpp
+++ b/flang/runtime/edit-output.cpp
@@ -822,6 +822,11 @@ RT_API_ATTRS bool EditLogicalOutput(
   case 'Z':
     return EditBOZOutput<4>(io, edit,
         reinterpret_cast<const unsigned char *>(&truth), sizeof truth);
+  case 'A': { // legacy extension
+    int truthBits{truth};
+    return EditCharacterOutput(
+        io, edit, reinterpret_cast<char *>(&truthBits), sizeof truthBits);
+  }
   default:
     io.GetIoErrorHandler().SignalError(IostatErrorInFormat,
         "Data edit descriptor '%c' may not be used with a LOGICAL data item",

diff  --git a/flang/unittests/Runtime/RuntimeCrashTest.cpp b/flang/unittests/Runtime/RuntimeCrashTest.cpp
index 0f25cc0ee8035b..a649051fdca0c5 100644
--- a/flang/unittests/Runtime/RuntimeCrashTest.cpp
+++ b/flang/unittests/Runtime/RuntimeCrashTest.cpp
@@ -53,16 +53,6 @@ TEST(TestTerminator, CheckFailedTest) {
 //------------------------------------------------------------------------------
 struct TestIOCrash : CrashHandlerFixture {};
 
-TEST(TestIOCrash, FormatDescriptorWriteMismatchTest) {
-  static constexpr int bufferSize{4};
-  static char buffer[bufferSize];
-  static const char *format{"(A4)"};
-  auto *cookie{IONAME(BeginInternalFormattedOutput)(
-      buffer, bufferSize, format, std::strlen(format))};
-  ASSERT_DEATH(IONAME(OutputLogical)(cookie, true),
-      "Data edit descriptor 'A' may not be used with a LOGICAL data item");
-}
-
 TEST(TestIOCrash, InvalidFormatCharacterTest) {
   static constexpr int bufferSize{1};
   static char buffer[bufferSize];


        


More information about the flang-commits mailing list