Uploaded image for project: 'Code Tools'
  1. Code Tools
  2. CODETOOLS-7903314

Jextract doesn't honor pack pragmas

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • None
    • None
    • 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

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

              Created:
              Updated:
              Resolved: