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: [email protected]
Reporter: [email protected]
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
}
---
--