[Issue 22777] New: stat struct in core.sys.windows.stat assumes CRuntime_DigitalMars

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Feb 16 02:27:50 UTC 2022


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

          Issue ID: 22777
           Summary: stat struct in core.sys.windows.stat assumes
                    CRuntime_DigitalMars
           Product: D
           Version: D2
          Hardware: All
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: druntime
          Assignee: nobody at puremagic.com
          Reporter: duser at airmail.cc

test program:

///
import core.sys.windows.stat;
import std.stdio;
struct X { struct_stat sb; ubyte[8] extra; }
void main()
{
        X x;
        stat(".", &x.sb);
        foreach (m; __traits(allMembers, struct_stat))
                writefln("%s = %s", m, __traits(getMember, x.sb, m));
        writefln("extra = %s", x.extra);
}
///

with "dmd -m32", the output looks normal

with "dmd -m32mscoff" or "dmd -m64" (same output), some of the fields are
misaligned and four bytes are written past the end of the struct

--


More information about the Digitalmars-d-bugs mailing list