https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94424
Bug ID: 94424 Summary: [D] Alignment holes can in structs can still end up with non-zero data Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: d Assignee: ibuclaw at gdcproject dot org Reporter: ibuclaw at gdcproject dot org Target Milestone: --- Example is a test that passes with -O0, but fails at -O2. @safe unittest { struct C { ubyte i; this(ubyte i) { this.i = i; } } auto c1 = C(1); auto c2 = C(2); assert(__cmp([c1, c1][], [c2, c2][]) < 0); assert(__cmp([c2, c2], [c1, c1]) > 0); assert(__cmp([c2, c2], [c2, c1]) > 0); } This happens despite the front-end attempting to do a best effort to plug all holes with zeroes.