Thread overview
[Issue 19223] core.simd __vector.array compiler crash
Sep 05, 2018
Nathan S.
Sep 28, 2018
Nicholas Wilson
Jan 28, 2019
Iain Buclaw
Mar 10, 2019
Dlang Bot
Mar 12, 2019
Dlang Bot
September 05, 2018
https://issues.dlang.org/show_bug.cgi?id=19223

Nathan S. <n8sh.secondary@hotmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://issues.dlang.org/sh
                   |                            |ow_bug.cgi?id=19224

--
September 28, 2018
https://issues.dlang.org/show_bug.cgi?id=19223

Nicholas Wilson <iamthewilsonator@hotmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |iamthewilsonator@hotmail.co
                   |                            |m

--- Comment #1 from Nicholas Wilson <iamthewilsonator@hotmail.com> ---
reduced to

---
void sum(int[4] val)
{
}

void main()
{
    import core.simd : int4;
    sum(int4.init.array);
}
---
 trips an assert in dmd/e2ir.d(117):

private elem *useOPstrpar(elem *e)
{
    tym_t ty = tybasic(e.Ety);
    if (ty == TYstruct || ty == TYarray)
    {
        e = el_una(OPstrpar, TYstruct, e);
        e.ET = e.EV.E1.ET;
        assert(e.ET); // <--- Here
    }
    return e;
}

AST reveals that
sum(int4.init.array);
becomes

sum(cast(__vector(int[4]))[0, 0, 0, 0]);

which obviously does not pass semantic.

sum((cast(__vector(int[4]))[0, 0, 0, 0]).array); // Error: cannot resolve type
for cast(__vector(int[4]))[0, 0, 0, 0]

auto x = (cast(__vector(int[4]))[0, 0, 0, 0]; // Error: cannot resolve type for
cast(__vector(int[4]))[0, 0, 0, 0]
which is bogus.

Workaround

int sum(const int[4] val)
{
    int sum = 0;
    foreach (x; val) sum += x;
    return sum;
}

void main()
{
    import core.simd : int4;
    auto x = int4.init;
    sum(x.array);
}

--
January 28, 2019
https://issues.dlang.org/show_bug.cgi?id=19223

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ibuclaw@gdcproject.org

--- Comment #2 from Iain Buclaw <ibuclaw@gdcproject.org> ---
*** Issue 19607 has been marked as a duplicate of this issue. ***

--
March 10, 2019
https://issues.dlang.org/show_bug.cgi?id=19223

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

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

--- Comment #3 from Dlang Bot <dlang-bot@dlang.rocks> ---
@ibuclaw created dlang/dmd pull request #9438 "[dmd-cxx] Backport vector array fixes from master" fixing this issue:

- fix Issue 19223 - core.simd __vector.array compiler crash

https://github.com/dlang/dmd/pull/9438

--
March 12, 2019
https://issues.dlang.org/show_bug.cgi?id=19223

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #9438 "[dmd-cxx] Backport vector array fixes from master" was merged into dmd-cxx:

- b4c3ba558434587abc8f53f8ca41b8ec49b80f4e by Iain Buclaw:
  fix Issue 19223 - core.simd __vector.array compiler crash

https://github.com/dlang/dmd/pull/9438

--