Bug 5355 – TLS variables are not 16 byte aligned

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2010-12-17T18:36:00Z
Last change time
2012-01-20T13:53:24Z
Keywords
wrong-code
Assigned to
nobody
Creator
elfy.nv

Comments

Comment #0 by elfy.nv — 2010-12-17T18:36:37Z
"Version D 2.007: Data items in static data segment >= 16 bytes in size are now paragraph aligned." Yet this test shows that neither double[4] nor creal are aligned. import core.stdc.stdio: printf; int a; double[4] d; creal cr; void main() { printf("%X:%u %X:%u %X:%u\n", &a, (cast(size_t)&a) % 8, &d, (cast(size_t)&d) % 8, &cr, (cast(size_t)&cr) % 8); }
Comment #1 by yebblies — 2011-07-03T09:51:34Z
Actually, those variables are in tls. Variables in the static data segment do seem to be 16 byte aligned. They appear to be all offset from 16 byte alignment by 4 bytes. Leaving open as this is probably not intended.
Comment #2 by bugzilla — 2012-01-20T13:53:24Z
TLS segments are now all 16 byte aligned. However, individual variables are aligned based on their type. For example, arrays are aligned based on the alignment requirement of their element type. Arrays of double are aligned on 8 byte boundaries, not 16 bytes.