The followng struct from /usr/include/linux/perf_event.h has the wrong size with ImportC: ``` struct perf_branch_entry { __u64 from; __u64 to; __u64 mispred:1, /* target mispredicted */ predicted:1,/* target predicted */ in_tx:1, /* in transaction */ abort:1, /* transaction abort */ cycles:16, /* cycle count to last branch */ type:4, /* branch type */ spec:2, /* branch speculation info */ new_type:4, /* additional branch type */ priv:3, /* privilege level */ reserved:31; }; ``` With ImportC and dmd -m32 on Linux this has size 28, but with gcc -m32 it has size 24. Found by comparing type sizes in druntime with type sizes found with ImportC: https://github.com/dlang/dmd/pull/16571
@tim-dlang created dlang/dmd pull request #16590 "Fix bugzilla 24592 - ImportC: Bitfield layout wrong for int64 on 32-b…" fixing this issue: - Fix bugzilla 24592 - ImportC: Bitfield layout wrong for int64 on 32-bit Linux Type ulong is 64-bit on 32-bit Linux, but has 32-bit alignment. This affects the layout of bitfields. Also add a new test for ImportC bitfields, which compares size, alignment and layout with the host C++ compiler. The existing tests compared with fixed values instead. https://github.com/dlang/dmd/pull/16590
dlang/dmd pull request #16590 "Fix bugzilla 24592 - ImportC: Bitfield layout wrong for int64 on 32-b…" was merged into master: - e427ca656d801bcc438afce7fd6fba94d0e860c5 by Tim Schendekehl: Fix bugzilla 24592 - ImportC: Bitfield layout wrong for int64 on 32-bit Linux Type ulong is 64-bit on 32-bit Linux, but has 32-bit alignment. This affects the layout of bitfields. Also add a new test for ImportC bitfields, which compares size, alignment and layout with the host C++ compiler. The existing tests compared with fixed values instead. https://github.com/dlang/dmd/pull/16590