On Tue, 3 Nov 2026 14:01:13 GMT, Jorn Vernee <[email protected]> wrote:

>> Jorn Vernee has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Fix canonical layouts + add test
>
> I've fixed a few more issues in the fallback linker identified by codex. 
> There were also some canonical layouts that had the wrong signedness. I've 
> now added a comprehensive test that checks the canonical layouts against 
> information extracted from the compiler on that platform (using a library).
> 
> Finally, I fixed a copy-paste error in the new `TestZeroExtendLong` jtreg 
> test definition, which was accidentally running the `TestZeroExtendInt` test.

Hi @JornVernee, as usual, things are more complicated on AIX ;-)


TestCanonicalLayouts::testCanonicalLayout '[2] char'
org.opentest4j.AssertionFailedError: expected: <true> but was: <false>

We are currently building with `-fsigned-char`. I guess the removal was 
forgotten. linux on ppc64(le) doesn't use that. I'll create a separate PR to 
remove it.


TestCanonicalLayouts::testCanonicalLayout '[13] double'
org.opentest4j.AssertionFailedError: expected: <4> but was: <8>

AIX has different alignment rules for `double`. We have already modified other 
tests to use 8 Byte alignment. So, my suggestion is:

diff --git a/test/jdk/java/foreign/canonicallayouts/libCanonicalLayouts.c 
b/test/jdk/java/foreign/canonicallayouts/libCanonicalLayouts.c
index eea98f2dc22..e6833b2ac19 100644
--- a/test/jdk/java/foreign/canonicallayouts/libCanonicalLayouts.c
+++ b/test/jdk/java/foreign/canonicallayouts/libCanonicalLayouts.c
@@ -21,6 +21,12 @@
  * questions.
  */
 
+#ifdef _AIX
+// The JDK prefers linux compatible double alignment by default.
+// Also see usage of #pragma align (natural)
+typedef double linux_double __attribute__((aligned(8)));
+#endif
+
 #include "export.h"
 
 #include <stdint.h>
@@ -48,7 +54,11 @@ CHECKS_ALL(T, NAME) \
 
 CHECKS_ALL(bool, bool)
 CHECKS_ALL(float, float)
+#ifdef _AIX
+CHECKS_ALL(linux_double, double)
+#else
 CHECKS_ALL(double, double)
+#endif
 CHECKS_ALL(void*, void_star)
 
 CHECKS_INTEGRAL(char, char)

-------------

PR Comment: https://git.openjdk.org/jdk/pull/33417#issuecomment-6659068050

Reply via email to