Bug 8565 – DMD 2.060 regression: align(1) broken

Status
RESOLVED
Resolution
INVALID
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-08-20T05:06:00Z
Last change time
2012-08-20T05:49:53Z
Assigned to
nobody
Creator
dlang-bugzilla

Comments

Comment #0 by dlang-bugzilla — 2012-08-20T05:06:21Z
This works in 2.059 but not in 2.060: align(1) struct LZMAHeader { uint compressedLength; ubyte compressionParameters; uint dictionarySize; static assert(dictionarySize.offsetof == 5); static assert(LZMAHeader.sizeof == 9); }
Comment #1 by alex — 2012-08-20T05:08:16Z
It's a known (and intended) breaking change. You have to put an align(1): before the fields of the struct for it to work now.
Comment #2 by alex — 2012-08-20T05:10:06Z
To clarify, align outside a struct now only affects the alignment of the struct itself, not its members. See: http://dlang.org/attribute.html#align
Comment #3 by dlang-bugzilla — 2012-08-20T05:10:47Z
Shouldn't there at least be a warning, then? Breaking changes are usually at least accompanied with a red notice at the top of the changelog...
Comment #4 by alex — 2012-08-20T05:12:44Z
(In reply to comment #3) > Shouldn't there at least be a warning, then? Breaking changes are usually at > least accompanied with a red notice at the top of the changelog... Yeah, good point. This should be noted with red in the change log. Will you make a pull request or should I?
Comment #5 by dlang-bugzilla — 2012-08-20T05:13:13Z
Please do. My hands are a bit full at the moment...
Comment #6 by public — 2012-08-20T05:33:42Z
Hm, have noticed this thread via dfeed, can you say something about similar one: http://stackoverflow.com/questions/11969058/how-to-fix-this-union-size-alignement-requirement-under-dmd-2-060 I have experimented with code sample there, and aligning both struct and its members does not work as intended if struct is anonymous. Bug?
Comment #7 by alex — 2012-08-20T05:34:20Z
(In reply to comment #5) > Please do. My hands are a bit full at the moment... https://github.com/D-Programming-Language/d-programming-language.org/pull/152
Comment #8 by alex — 2012-08-20T05:38:48Z
(In reply to comment #6) > Hm, have noticed this thread via dfeed, can you say something about similar > one: > http://stackoverflow.com/questions/11969058/how-to-fix-this-union-size-alignement-requirement-under-dmd-2-060 > > I have experimented with code sample there, and aligning both struct and its > members does not work as intended if struct is anonymous. Bug? I posted a solution on the SO question. I'm not sure if that's a bug or not, but it does look suspicious. Can you file a separate bug, so we can investigate?
Comment #9 by public — 2012-08-20T05:49:53Z
Sure, http://d.puremagic.com/issues/show_bug.cgi?id=8566 ( I am not SO question author, just bringing attention to subject )