This cause ldc compiled with dmd to crash, because of an unaligned SIMD instruction.
Comment #1 by yshuiv7 — 2018-08-08T01:23:04Z
Whops, not the problem. But ldc still crashes, looking into it...
Comment #2 by yshuiv7 — 2018-08-09T10:14:28Z
Looks like dmd mis-aligned a __gshared variable. .alignof reports an alignment of 16 bytes, while the variable is aligned only to 8 bytes.
Comment #3 by yshuiv7 — 2018-08-10T00:39:25Z
I found the actual bug in codegen. In elfobj.c data_start(), when a symbol doesn't have a explicit alignment (Salignment <= 0), the symbol itself is aligned, but its section's alignment is not updated.
To reproduce:
__gshared real x;
pragma(msg, x.alignof);
Compiling it prints: 16LU, but the .data section of the resulting object file is only aligned to 8 bytes.
Comment #4 by dbugz — 2018-08-25T15:25:27Z
Which ldc and DMD versions? Does the just-released LDC 1.11 have this problem?
Comment #5 by yshuiv7 — 2018-08-25T19:21:19Z
(In reply to Joakim from comment #4)
> Which ldc and DMD versions? Does the just-released LDC 1.11 have this
> problem?
Most recent ldc release fix the build problem. But this is a dmd bug nonetheless.
This bug still exists in dmd master
OK, if you're so sure it's a problem in dmd's backend, a pull request is welcome.
Comment #9 by yshuiv7 — 2018-08-26T18:55:51Z
(In reply to Joakim from comment #8)
> OK, if you're so sure it's a problem in dmd's backend, a pull request is
> welcome.
While I know where the problem is, I don't know what is the proper fix. So I would need some help.
Comment #10 by robert.schadek — 2024-12-13T19:00:11Z