www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24592] New: ImportC: Bitfield layout wrong for int64 on

https://issues.dlang.org/show_bug.cgi?id=24592

          Issue ID: 24592
           Summary: ImportC: Bitfield layout wrong for int64 on 32-bit
                    Linux
           Product: D
           Version: D2
          Hardware: x86
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: tim.dlang t-online.de

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

--
Jun 09