Bug 10518 – Static SIMD vector constants cannot be defined.

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-06-30T23:50:00Z
Last change time
2013-07-02T19:08:49Z
Keywords
ice
Assigned to
nobody
Creator
Marco.Leise

Comments

Comment #0 by Marco.Leise — 2013-06-30T23:50:21Z
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.
Comment #1 by henning — 2013-07-02T19:08:49Z
*** This issue has been marked as a duplicate of issue 10312 ***