[Issue 10518] New: Static SIMD vector constants cannot be defined.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jun 30 23:50:22 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10518

           Summary: Static SIMD vector constants cannot be defined.
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: ice
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: Marco.Leise at gmx.de


--- Comment #0 from Marco Leise <Marco.Leise at gmx.de> 2013-06-30 23:50:21 PDT ---
I've tested two ways to define a global SIMD constant and found this:

-------8<---------

import core.simd;
import std.stdio;

version (DigitalMars) { enum isDMD = true;  enum isGDC = false; enum isLDC =
false; }
else version (GNU)    { enum isDMD = false; enum isGDC = true;  enum isLDC =
false; }
else version (LDC)    { enum isDMD = false; enum isGDC = false; enum isLDC =
true;  }

void main()
{
    static if (!isLDC) {
        // ldc: Error: expression
'cast(immutable(__vector(ubyte[16LU])))cast(ubyte)123u' is not a constant
        static immutable ubyte16 vec1 = 123;
        writeln(vec1.array);
    }

    static if (!isDMD && !isLDC && !isGDC) {
        // dmd: init.c:660: virtual Expression*
ArrayInitializer::toExpression(Type*): Assertion `0' failed.
        // gdc: init.c:615: virtual Expression*
ArrayInitializer::toExpression(): Assertion `0' failed.
        // ldc: infinite loop
        static immutable ubyte16 vec2 =
[123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123];
        writeln(vec2.array);
    }
}

-------->8----------

So DMD crashes when given a full initializer array, but works with a scalar.
I'd expect both to work and the array initializer be the more general case.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list