Thread overview
[Issue 20154] bad closure if local variables have larger alignment requirements
Aug 09, 2020
Walter Bright
Aug 09, 2020
Walter Bright
Aug 09, 2020
Walter Bright
Aug 09, 2020
Rainer Schuetze
Aug 09, 2020
Walter Bright
Aug 29, 2020
Walter Bright
Dec 17, 2022
Iain Buclaw
August 09, 2020
https://issues.dlang.org/show_bug.cgi?id=20154

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com

--- Comment #1 from Walter Bright <bugzilla@digitalmars.com> ---
The alignment code is emitted for Win64, but not for Win32. But you listed the bug applying to x86_64.

So please clarify:

Is this working for 64 bit platforms?

--
August 09, 2020
https://issues.dlang.org/show_bug.cgi?id=20154

--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> ---
Currently, stack alignment is enforced only for 64 bit compilations and 32 bit OSX compilations. See the setting of `enforcealign` in codgen() in cgcod.d.

--
August 09, 2020
https://issues.dlang.org/show_bug.cgi?id=20154

--- Comment #3 from Walter Bright <bugzilla@digitalmars.com> ---
A somewhat more illustrative test:


struct SpinLock
{
    align(64)
        int x;
}

void collectReferences(int x) //ref HashTab references)
{
    SpinLock lock = SpinLock(8); // dmd BUG: alignment causes bad capture!

    void mark() scope nothrow
    {
        assert(lock.x == 8);
        assert(x == 7);
    }

    mark();
}

void main()
{
    collectReferences(7);
}

--
August 09, 2020
https://issues.dlang.org/show_bug.cgi?id=20154

--- Comment #4 from Rainer Schuetze <r.sagitario@gmx.de> ---
(In reply to Walter Bright from comment #1)
> The alignment code is emitted for Win64, but not for Win32. But you listed the bug applying to x86_64.

Win32 passes the assert, but ignores alignments.

> 
> So please clarify:
> 
> Is this working for 64 bit platforms?

No.

--
August 09, 2020
https://issues.dlang.org/show_bug.cgi?id=20154

--- Comment #5 from Walter Bright <bugzilla@digitalmars.com> ---
Thanks, I think I understand it now. But the solution isn't obvious :-/

--
August 29, 2020
https://issues.dlang.org/show_bug.cgi?id=20154

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |backend

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=20154

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P3

--