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

via flang-commits flang-commits at lists.llvm.org
Wed Aug 14 06:16:24 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-flang-semantics

Author: Daniel Chen (DanielCChen)

<details>
<summary>Changes</summary>

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

---
Full diff: https://github.com/llvm/llvm-project/pull/103928.diff


2 Files Affected:

- (modified) flang/include/flang/Evaluate/integer.h (+3-2) 
- (modified) flang/lib/Evaluate/integer.cpp (+2-1) 


``````````diff
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

``````````

</details>


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


More information about the flang-commits mailing list