[Issue 9304] New: Unary minus operator doesn't work correctly with SIMD types.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jan 12 11:01:39 PST 2013


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

           Summary: Unary minus operator doesn't work correctly with SIMD
                    types.
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: jerro.public at gmail.com


--- Comment #0 from jerro.public at gmail.com 2013-01-12 11:01:38 PST ---
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.

-- 
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