Bug 17237 – Wrong alignment of 256-bit and 512-bit vectors

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-03-01T22:10:00Z
Last change time
2017-08-07T13:15:25Z
Assigned to
nobody
Creator
ibuclaw
See also
https://issues.dlang.org/show_bug.cgi?id=16087

Comments

Comment #0 by ibuclaw — 2017-03-01T22:10:24Z
Target field alignment returned by GDC (and probably LDC too) is being overwritten/ignored by the frontend if it considers it wrong from an x86 standpoint. Here's one example that affects both DMD and GDC for different reasons. --- struct vec_struct { bool b2; struct { bool b; int8 field; } } static assert(vec_struct.b.offsetof == 32); // Fails, offset == 8 static assert(vec_struct.field.offsetof == 64); // Fails, offset == 40 !!! ---
Comment #1 by ibuclaw — 2017-03-01T22:11:43Z
On a mild ranting note, this is the offender in the frontend. --- // AggregateDeclaration.placeField (aggregate.d) if ((global.params.is64bit || global.params.isOSX) && memalignsize == 16) { } else if (8 < memalignsize) memalignsize = 8; --- For DMD - you seem to have forgotten that you support 256-bit vectors. For GDC, you're ignoring the target-specific alignment of fields that we return, instead enforcing that everything must fit your x86 view of ABI. This piece of code should be moved to Target::fieldalign where it deservedly belongs.
Comment #2 by github-bugzilla — 2017-03-02T02:21:10Z
Commits pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/10eba509d6a5dfbe509fa1ffe7f4c3962a58a490 fix Issue 17237 - Wrong alignment for 256-bit vectors. https://github.com/dlang/dmd/commit/25f8bc5bbb2e843fb3ab381d13f4ce919eae0958 Merge pull request #6582 from ibuclaw/issue17237 fix Issue 17237 - Wrong alignment for 256-bit vectors.
Comment #3 by github-bugzilla — 2017-03-05T01:24:38Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/10eba509d6a5dfbe509fa1ffe7f4c3962a58a490 fix Issue 17237 - Wrong alignment for 256-bit vectors. https://github.com/dlang/dmd/commit/25f8bc5bbb2e843fb3ab381d13f4ce919eae0958 Merge pull request #6582 from ibuclaw/issue17237
Comment #4 by github-bugzilla — 2017-08-07T13:15:25Z
Commits pushed to newCTFE at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/10eba509d6a5dfbe509fa1ffe7f4c3962a58a490 fix Issue 17237 - Wrong alignment for 256-bit vectors. https://github.com/dlang/dmd/commit/25f8bc5bbb2e843fb3ab381d13f4ce919eae0958 Merge pull request #6582 from ibuclaw/issue17237