Thread overview
[Issue 8565] New: DMD 2.060 regression: align(1) broken
Aug 20, 2012
Vladimir Panteleev
Aug 20, 2012
Vladimir Panteleev
Aug 20, 2012
Vladimir Panteleev
Aug 20, 2012
Mihail Strashun
Aug 20, 2012
Mihail Strashun
August 20, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8565

           Summary: DMD 2.060 regression: align(1) broken
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: thecybershadow@gmail.com


--- Comment #0 from Vladimir Panteleev <thecybershadow@gmail.com> 2012-08-20 05:06:21 PDT ---
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);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 20, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8565


Alex Rønne Petersen <alex@lycus.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |alex@lycus.org
         Resolution|                            |INVALID


--- Comment #1 from Alex Rønne Petersen <alex@lycus.org> 2012-08-20 14:08:16 CEST ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 20, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8565



--- Comment #2 from Alex Rønne Petersen <alex@lycus.org> 2012-08-20 14:10:06 CEST ---
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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 20, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8565



--- Comment #3 from Vladimir Panteleev <thecybershadow@gmail.com> 2012-08-20 05:10:47 PDT ---
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...

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 20, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8565



--- Comment #4 from Alex Rønne Petersen <alex@lycus.org> 2012-08-20 14:12:44 CEST ---
(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?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 20, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8565



--- Comment #5 from Vladimir Panteleev <thecybershadow@gmail.com> 2012-08-20 05:13:13 PDT ---
Please do. My hands are a bit full at the moment...

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 20, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8565


Mihail Strashun <m.strashun@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |m.strashun@gmail.com


--- Comment #6 from Mihail Strashun <m.strashun@gmail.com> 2012-08-20 05:33:42 PDT ---
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?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 20, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8565



--- Comment #7 from Alex Rønne Petersen <alex@lycus.org> 2012-08-20 14:34:20 CEST ---
(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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 20, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8565



--- Comment #8 from Alex Rønne Petersen <alex@lycus.org> 2012-08-20 14:38:48 CEST ---
(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?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 20, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8565



--- Comment #9 from Mihail Strashun <m.strashun@gmail.com> 2012-08-20 05:49:53 PDT ---
Sure, http://d.puremagic.com/issues/show_bug.cgi?id=8566
( I am not SO question author, just bringing attention to subject )

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------