[flang-commits] [flang] [flang] pass true/false to EditLogicalOutput directly (NFC) (PR #73375)

via flang-commits flang-commits at lists.llvm.org
Wed Dec 6 08:12:26 PST 2023


https://github.com/kkwli updated https://github.com/llvm/llvm-project/pull/73375

>From ed0e7e0c612d188d43c6ba17259a6b61613cb1d3 Mon Sep 17 00:00:00 2001
From: Kelvin Li <kli at ca.ibm.com>
Date: Fri, 24 Nov 2023 18:01:11 -0500
Subject: [PATCH 1/2] [flang] pass true/false to EditLogicalOutput directly

---
 flang/runtime/edit-output.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/flang/runtime/edit-output.cpp b/flang/runtime/edit-output.cpp
index 18b209bc6798c..3056cc6924d5c 100644
--- a/flang/runtime/edit-output.cpp
+++ b/flang/runtime/edit-output.cpp
@@ -140,7 +140,7 @@ bool EditIntegerOutput(IoStatementState &io, const DataEdit &edit,
     return EditBOZOutput<4>(
         io, edit, reinterpret_cast<const unsigned char *>(&n), KIND);
   case 'L':
-    return EditLogicalOutput(io, edit, *reinterpret_cast<const char *>(&n));
+    return EditLogicalOutput(io, edit, n == 0 ? false : true);
   case 'A': // legacy extension
     return EditCharacterOutput(
         io, edit, reinterpret_cast<char *>(&n), sizeof n);

>From cfd654a968185ac21322e214afc0e80bb084d580 Mon Sep 17 00:00:00 2001
From: Kelvin Li <kli at ca.ibm.com>
Date: Wed, 6 Dec 2023 11:11:34 -0500
Subject: [PATCH 2/2] Use n != 0 instead

---
 flang/runtime/edit-output.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/flang/runtime/edit-output.cpp b/flang/runtime/edit-output.cpp
index 3056cc6924d5c..18e2a3f1e537c 100644
--- a/flang/runtime/edit-output.cpp
+++ b/flang/runtime/edit-output.cpp
@@ -140,7 +140,7 @@ bool EditIntegerOutput(IoStatementState &io, const DataEdit &edit,
     return EditBOZOutput<4>(
         io, edit, reinterpret_cast<const unsigned char *>(&n), KIND);
   case 'L':
-    return EditLogicalOutput(io, edit, n == 0 ? false : true);
+    return EditLogicalOutput(io, edit, n != 0 ? true : false);
   case 'A': // legacy extension
     return EditCharacterOutput(
         io, edit, reinterpret_cast<char *>(&n), sizeof n);



More information about the flang-commits mailing list