RFR: 7904115: Fix for AIX test case failures due to incorrect alignment for double and pointer [v2]
Varada M
varadam at openjdk.org
Fri Nov 21 12:57:41 UTC 2025
On Thu, 20 Nov 2025 14:32:43 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:
>> src/main/java/org/openjdk/jextract/impl/ClassSourceBuilder.java line 269:
>>
>>> 267: } else {
>>> 268: yield alignIfNeeded(runtimeHelperName() + ".C_DOUBLE", 4, align);
>>> 269: }
>>
>> Why are there 2 cases here?
>
> Couldn't this be:
>
>
> case Double -> alignIfNeeded(runtimeHelperName() + ".C_DOUBLE", (TypeImpl.IS_AIX ? 4 : 8), align);
yes right.
These are my findings!
`case Double -> alignIfNeeded(runtimeHelperName() + ".C_DOUBLE", (TypeImpl.IS_AIX ? 4 : 8), align);`
The above fix solves most of the failures except two of them. This solves the failure like "Unsupported layout: 4%D8"
The remaining two test failures are due to 'IllegalArgumentException: Invalid alignment constraint for member layout: D8(d)'
I observed that the expected alignment is 8 for them and the ABI expects the alignment constraint for d to be 4, not 8
For one of the test failure : jtreg/generator/testStruct/LibStructTest.java
For the [struct AllTypes](https://github.com/varada1110/jextract/blob/91ff2392ac8c3ee7d0906486e8f523fccdf34c44/test/jtreg/generator/testStruct/struct.h#L41), the double d field is not the first field, so according to AIX power mode rules, subsequent doubles are aligned on 4-byte boundaries, not 8
>> src/main/java/org/openjdk/jextract/impl/Options.java line 92:
>>
>>> 90: if (TypeImpl.IS_AIX) {
>>> 91: clangArgs.add("-m64");
>>> 92: }
>>
>> This doesn't look like the right place to add this, as the `-m64` flag would be added for each clang argument.
>
> I think an extra call to `addClangArg` should be added to `JextractTool`.
Fixed it. Thank you
-------------
PR Review Comment: https://git.openjdk.org/jextract/pull/296#discussion_r2549667764
PR Review Comment: https://git.openjdk.org/jextract/pull/296#discussion_r2549675947
More information about the jextract-dev
mailing list