[Bug d/94424] New: [D] Alignment holes can in structs can still end up with non-zero data
ibuclaw at gdcproject dot org
gcc-bugzilla@gcc.gnu.org
Tue Mar 31 14:13:58 GMT 2020
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.
More information about the Gcc-bugs
mailing list