Thread overview
[Issue 10826] [GC] Should the D GC allocate double4[] aligned to 32 bytes?
Aug 10, 2020
Dlang Bot
Oct 28, 2022
kinke
[Issue 10826] GC doesn't respect type alignments > 16 bytes
Oct 28, 2022
kinke
August 09, 2020
https://issues.dlang.org/show_bug.cgi?id=10826

Steven Schveighoffer <schveiguy@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schveiguy@yahoo.com
           Assignee|nobody@puremagic.com        |schveiguy@yahoo.com

--- Comment #3 from Steven Schveighoffer <schveiguy@yahoo.com> ---
This came up again: https://forum.dlang.org/post/rgionugyekzpxuetyslh@forum.dlang.org

I have an idea that might work: when allocating an array of items with alignment greater than 16 bytes, just offset the first element when calculating the size.

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

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #4 from Dlang Bot <dlang-bot@dlang.rocks> ---
@schveiguy created dlang/druntime pull request #3192 "fix issue 10826 -- make sure large arrays obey 32-byte or greater alignment" fixing this issue:

- fix issue 10826 -- make sure 32-byte aligned types (such as
  __vector(ubyte[32]) ) are aligned to 32-bytes when put into large
  arrays.

https://github.com/dlang/druntime/pull/3192

--
October 28, 2022
https://issues.dlang.org/show_bug.cgi?id=10826

kinke <kinke@gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kinke@gmx.net
           Severity|enhancement                 |critical

--- Comment #5 from kinke <kinke@gmx.net> ---
Raising the importance to critical. Greater-than-natural alignments are respected by LDC pretty much everywhere AFAIK (stack and globals) - except for druntime's GC. And are used for optimizations. It's pretty embarrassing that people cannot safely GC-allocate arrays of vectors > 128 bit without potentially hitting segfaults (incl. @safe code obviously).

And it's obviously not limited to vectors or arrays, but applies to all GC allocations of types with alignment > 16.

--
October 28, 2022
https://issues.dlang.org/show_bug.cgi?id=10826

kinke <kinke@gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[GC] Should the D GC        |GC doesn't respect type
                   |allocate double4[] aligned  |alignments > 16 bytes
                   |to 32 bytes?                |

--