Bug 9304 – Unary minus operator doesn't work correctly with SIMD types.
Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-01-12T11:01:00Z
Last change time
2013-01-15T13:51:34Z
Assigned to
nobody
Creator
jerro.public
Comments
Comment #0 by jerro.public — 2013-01-12T11:01:38Z
The following code does not work correctly when compiled with DMD 2.061 with -O flag:
import std.stdio;
import core.simd;
// alias float4 T; // internal compiler error
alias int4 T; // wrong result
T foo(T a)
{
return -a;
}
void main()
{
auto a = foo([0, 1, 2, 3]);
writeln(a.array);
}
If T is float4, I get internal compiler error:
Internal error: ../ztc/cgxmm.c 57
If T is int4, the code compiles, but prints this when I run it (the first number is different each time, the other three stay the same):
[-1111986510, 32712, 0, 0]
If I don't use -O flag, the code compiles and works correctly for both int4 and float4.
Comment #1 by github-bugzilla — 2013-01-15T03:07:27Z