www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23218] New: ICE: src/dmd/backend/cgxmm.d:1373: Assertion `0'


          Issue ID: 23218
           Summary: ICE: src/dmd/backend/cgxmm.d:1373: Assertion `0'
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ibuclaw gdcproject.org

The problem is that the cast ends up being represented as a VectorExp
constructed from a static (or dynamic) array, but dmd only handles the array
literal case, so treats the `a` parameter as a single element.

What it should instead do is a view conversion from static array to vector.
auto convtest(int[4] a)
    return cast(__vector(int[4]))a;

void main()
    // prints 1
    pragma(msg, convtest([1,2,3,4])[0]);
    // Passes CTFE -> OK
    static assert(convtest([1,2,3,4])[0] == 1);
    // src/dmd/backend/cgxmm.d:1373: Assertion `0' failed.
    assert(convtest([1,2,3,4])[0] == 1);

Jun 29 2022