www.digitalmars.com         C & C++   DMDScript  

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

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: jerro.public gmail.com


--- Comment #0 from jerro.public 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: -------
Jan 12 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9304



--- Comment #1 from github-bugzilla puremagic.com 2013-01-15 03:07:27 PST ---
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/ecb14d78cdd04813382676e9ff10e3c43c5bdb63
fix Issue 9304 - Unary minus operator doesn't work correctly with SIMD types.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 15 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9304


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com


--- Comment #2 from Walter Bright <bugzilla digitalmars.com> 2013-01-15
13:48:14 PST ---
https://github.com/D-Programming-Language/dmd/pull/1488

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 15 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9304



--- Comment #3 from github-bugzilla puremagic.com 2013-01-15 13:49:52 PST ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/d6eaab75bead8f17e4b045add7c4b5bd1bc91365
fix Issue 9304 - Unary minus operator doesn't work correctly with SIMD types.

https://github.com/D-Programming-Language/dmd/commit/065f9861652a510c9afc0747c3f066927934e1e9
Merge pull request #1488 from WalterBright/b10

fix Issue 9304 - Unary minus operator doesn't work correctly with SIMD t...

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 15 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9304


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
           Platform|x86_64                      |All
         Resolution|                            |FIXED
         OS/Version|Linux                       |All


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