[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:38 PST 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-flang-runtime
Author: None (kkwli)
<details>
<summary>Changes</summary>
Using `reinterpret_cast<const char *>(&n)` will cause issue in the big endian environment when `KIND>1`.
---
Full diff: https://github.com/llvm/llvm-project/pull/73375.diff
1 Files Affected:
- (modified) flang/runtime/edit-output.cpp (+1-1)
``````````diff
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);
``````````
</details>
https://github.com/llvm/llvm-project/pull/73375
More information about the flang-commits
mailing list