Integrated: 7903481: Jextract doesn't enforce group layout alignment correctly in some cases
Maurizio Cimadamore
mcimadamore at openjdk.org
Tue May 30 14:41:27 UTC 2023
On Tue, 30 May 2023 11:49:05 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
> This patch overhauls the treatment of pragma packs directives.
>
> The current logic tries to detect fields occurring at misaligned offsets, and relaxes alignment constraints for these fields.
> However, in cases like this:
>
>
> #pragma pack(push, 1)
> struct A {
> long long a;
> int b;
> }
>
>
> Each field is correctly aligned. But the struct size (12) is not a multiple of its natural alignment (8). As a result, we run into issues when building a sequence layout out of this struct, because of the eager checks added to the layout API.
>
> This patch fixes support for packed structs "the right way", that is, by asking clang the struct/union alignment, and then making sure that any field is aligned accordingly before the group layout is created.
This pull request has now been integrated.
Changeset: c3deba2d
Author: Maurizio Cimadamore <mcimadamore at openjdk.org>
URL: https://git.openjdk.org/jextract/commit/c3deba2d52f5d57e3c616fedc324d12cf545a77e
Stats: 105 lines in 9 files changed: 79 ins; 6 del; 20 mod
7903481: Jextract doesn't enforce group layout alignment correctly in some cases
Reviewed-by: jvernee
-------------
PR: https://git.openjdk.org/jextract/pull/121
More information about the jextract-dev
mailing list