[flang-commits] [flang] [flang] pass true/false to EditLogicalOutput directly (PR #73375)
via flang-commits
flang-commits at lists.llvm.org
Fri Nov 24 15:10:10 PST 2023
https://github.com/kkwli created https://github.com/llvm/llvm-project/pull/73375
Using `reinterpret_cast<const char *>(&n)` will cause issue in the big endian environment when `KIND>1`.
>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] [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 18b209bc6798c33..3056cc6924d5c9c 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);
More information about the flang-commits
mailing list