www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10518] New: Static SIMD vector constants cannot be defined.

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: Marco.Leise gmx.de


--- Comment #0 from Marco Leise <Marco.Leise 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: -------
Jun 30 2013
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10518


Henning Pohl <henning still-hidden.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |henning still-hidden.de
         Resolution|                            |DUPLICATE


--- Comment #1 from Henning Pohl <henning still-hidden.de> 2013-07-02 19:08:49
PDT ---
*** This issue has been marked as a duplicate of issue 10312 ***

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