www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16038] New: -O Codegen bug: Missing floating-point negation

https://issues.dlang.org/show_bug.cgi?id=16038

          Issue ID: 16038
           Summary: -O Codegen bug: Missing floating-point negation
           Product: D
           Version: D2
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: thomas.bockman gmail.com

This works fine without optimizations, or with optimizations on GDC and LDC.

Both 32- and 64-bit are effected.
---
module app;

F foo(F)(F x)
{
    F ret = 1;
    ret = -ret;
    return ret;
}

void main() {
    import std.stdio;
    writeln(foo(-168.1234L));  // DMD: -1
    writeln(foo(-168.1234));   // DMD:  1
    writeln(foo(-168.1234f));  // DMD:  1.00002
}
---

--
May 17 2016