[flang-commits] [flang] [flang][AIX] Suppress AIX compat error (NFC) (PR #177174)

Kelvin Li via flang-commits flang-commits at lists.llvm.org
Wed Jan 21 06:22:49 PST 2026


https://github.com/kkwli created https://github.com/llvm/llvm-project/pull/177174

Suppress the following message

```
llvm-project/flang/include/flang/Evaluate/real.h:499:37: error: alignment of 16 bytes for a struct member is not binary compatible with IBM XL C/C++ for AIX 16.1.0 or older [-Werror,-Waix-compat]
  499 |   alignas(Word::alignment / 8) Word word_{}; // an Integer<>
      |                                     ^

```

>From 073c43635846913607bb9e2de28353c082685136 Mon Sep 17 00:00:00 2001
From: Kelvin Li <kli at ca.ibm.com>
Date: Tue, 20 Jan 2026 11:51:23 -0500
Subject: [PATCH] [flang][AIX] Suppress AIX compat error (NFC)

---
 flang/include/flang/Evaluate/real.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/flang/include/flang/Evaluate/real.h b/flang/include/flang/Evaluate/real.h
index c0a966820d13e..391d4e057f134 100644
--- a/flang/include/flang/Evaluate/real.h
+++ b/flang/include/flang/Evaluate/real.h
@@ -30,6 +30,12 @@ namespace Fortran::evaluate::value {
 // LOG10(2.)*1E12
 static constexpr std::int64_t ScaledLogBaseTenOfTwo{301029995664};
 
+// Ignore error about requesting a large alignment not being ABI compatible
+// with older AIX systems.
+#if defined(_AIX)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Waix-compat"
+#endif
 // Models IEEE binary floating-point numbers (IEEE 754-2008,
 // ISO/IEC/IEEE 60559.2011).  The first argument to this
 // class template must be (or look like) an instance of Integer<>;
@@ -498,6 +504,9 @@ template <typename WORD, int PREC> class Real {
   // by unaligned address.
   alignas(Word::alignment / 8) Word word_{}; // an Integer<>
 };
+#if defined(_AIX)
+#pragma GCC diagnostic pop
+#endif
 
 extern template class Real<Integer<16>, 11>; // IEEE half format
 extern template class Real<Integer<16>, 8>; // the "other" half format



More information about the flang-commits mailing list