[flang-commits] [flang] [llvm] [flang][PPC] Implement ieee_set_status and ieee_get_status for AIX (PR #215618)
Eugene Epshteyn via flang-commits
flang-commits at lists.llvm.org
Mon Aug 17 20:55:57 PDT 2026
================
@@ -142,3 +142,19 @@ TEST(Exceptions, ClearOneLeavesOthersAlone) {
GTEST_SKIP() << "FE_OVERFLOW and FE_INVALID required for this test";
#endif
}
+
+TEST(Exceptions, GetStatusTypeSizeMatchesPlatformLayout) {
+ const std::size_t sz{RTNAME(GetStatusTypeSize)()};
+#if defined(_AIX)
+ EXPECT_EQ(sz, sizeof(std::fenv_t) + sizeof(double))
+ << "expected sizeof(fenv_t)+sizeof(double)="
+ << sizeof(std::fenv_t) + sizeof(double);
+#else
+ EXPECT_EQ(sz, sizeof(std::fenv_t))
+ << "expected sizeof(fenv_t)=" << sizeof(std::fenv_t);
+#endif
+ // The size must fit in ieee_status_type.__data as integer(4) with
+ // extent _FORTRAN_RUNTIME_IEEE_FENV_T_EXTENT.
+ EXPECT_LE(sz, 32u)
+ << "GetStatusTypeSize exceeds the 32-byte ieee_status_type.__data field";
----------------
eugeneepshteyn wrote:
(This comment was generated by AI.)
This `EXPECT_LE` sits outside the `#if defined(_AIX)` block, so it asserts on every platform that `GetStatusTypeSize() <= 32` — but the comment in `magic-numbers.h` explicitly permits environments whose `fenv_t` exceeds the inline `__data` extent (they use the runtime-sized allocation path from #121949), and on Solaris/SPARC `sizeof(fenv_t)` is well over 32, so this test fails on exactly the platform that mechanism protects. Suggest scoping the assertion under `#if defined(_AIX)`, where the inline two-part layout really is the contract this PR creates, or dropping it.
https://github.com/llvm/llvm-project/pull/215618
More information about the flang-commits
mailing list