On Wednesday, 1 March 2017 at 22:15:59 UTC, Iain Buclaw wrote:
On Wednesday, 1 March 2017 at 19:09:24 UTC, Johan Engelen wrote:
On Wednesday, 1 March 2017 at 18:34:16 UTC, Iain Buclaw wrote:

Simple test case would be:

struct vec_struct {
    bool b2;
    struct {
        bool b;
        int8 field;
    }
}

static assert(vec_struct.b.offsetof == 32);
static assert(vec_struct.field.offsetof == 64);

With explicit align(32), it works:
https://godbolt.org/g/3GjOHW

- Johan

Well obviously, because it adheres to explicit alignment. The compiler just has the wrong idea of how default alignment should work.

Raised bug here, and I'm raising a PR now also. https://issues.dlang.org/show_bug.cgi?id=17237

Thanks for your help Iain. And many thanks btw for all the general good work which is very much appreciated by this particular geriatric asm programmer.

I checked the case of XMM alignment, and it's fine.

I presume D does not yet support 512-bit zmm vector objects? (I have seen GDC doing a nice job generating auto-vectorised AVX512 code though - thanks.) The same bug would presumably bite again in that case otherwise?

Reply via email to