Jextract doesn't honor pack pragmas

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P3
    • None
    • Affects Version/s: None
    • Component/s: tools

      C programs can have less strict alignment constraints using pragmas directives:

      #pragma pack(4)

      struct packed_struct {
              int x;
              long long y;
              long long z;
      }

      Currently, jextract ignores these directives, and ends up generating layouts which feature standard alignment constraint. In the above case, this would lead to issues, since "y" is not 64-bit aligned. That is, jextract needs to tweak the alignment constraint associated with the struct layout, to make sure that the layout is well formed w.r.t. alignment constraints.

      Original problem reported here:
      https://mail.openjdk.java.net/pipermail/panama-dev/2021-January/011820.html

            Assignee:
            Maurizio Cimadamore
            Reporter:
            Maurizio Cimadamore
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: