[flang-commits] [flang] [Flang]: Use actual endianness for Integer<80> (PR #103928)

Daniel Chen via flang-commits flang-commits at lists.llvm.org
Wed Aug 14 06:15:49 PDT 2024


https://github.com/DanielCChen created https://github.com/llvm/llvm-project/pull/103928

This PR is to use the actual endianness of the platform when instantiate Integer<80> so that AIX (big-endian) will not get confused.

>From accda10ba585421dc99df83ae5cf468c9698457f Mon Sep 17 00:00:00 2001
From: Daniel Chen <cdchen at ca.ibm.com>
Date: Wed, 14 Aug 2024 09:12:02 -0400
Subject: [PATCH] [Flang]: Use actual endianness for Integer<80>

---
 flang/include/flang/Evaluate/integer.h | 5 +++--
 flang/lib/Evaluate/integer.cpp         | 3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/flang/include/flang/Evaluate/integer.h b/flang/include/flang/Evaluate/integer.h
index 4c7d88328a71e7..e69876f07b63cb 100644
--- a/flang/include/flang/Evaluate/integer.h
+++ b/flang/include/flang/Evaluate/integer.h
@@ -1056,8 +1056,9 @@ extern template class Integer<16>;
 extern template class Integer<32>;
 extern template class Integer<64>;
 using X87IntegerContainer =
-    Integer<80, true, 16, std::uint16_t, std::uint32_t, 128>;
-extern template class Integer<80, true, 16, std::uint16_t, std::uint32_t, 128>;
+    Integer<80, isHostLittleEndian, 16, std::uint16_t, std::uint32_t, 128>;
+extern template class Integer<80, isHostLittleEndian, 16, std::uint16_t,
+    std::uint32_t, 128>;
 extern template class Integer<128>;
 } // namespace Fortran::evaluate::value
 #endif // FORTRAN_EVALUATE_INTEGER_H_
diff --git a/flang/lib/Evaluate/integer.cpp b/flang/lib/Evaluate/integer.cpp
index b982a3a0796cc5..17a38fa17a67cc 100644
--- a/flang/lib/Evaluate/integer.cpp
+++ b/flang/lib/Evaluate/integer.cpp
@@ -14,7 +14,8 @@ template class Integer<8>;
 template class Integer<16>;
 template class Integer<32>;
 template class Integer<64>;
-template class Integer<80, true, 16, std::uint16_t, std::uint32_t, 128>;
+template class Integer<80, isHostLittleEndian, 16, std::uint16_t, std::uint32_t,
+    128>;
 template class Integer<128>;
 
 // Sanity checks against misconfiguration bugs



More information about the flang-commits mailing list