D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 16038 - -O Codegen bug: Missing floating-point negation
Summary: -O Codegen bug: Missing floating-point negation
Status: RESOLVED DUPLICATE of issue 16027
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All Linux
: P1 major
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-18 02:17 UTC by thomas.bockman
Modified: 2016-05-18 02:31 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description thomas.bockman 2016-05-18 02:17:32 UTC
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
}
---
Comment 1 safety0ff.bugz 2016-05-18 02:21:05 UTC
Possible duplicate of issue 16027.
Comment 2 thomas.bockman 2016-05-18 02:31:51 UTC
> Possible duplicate of issue 16027.

Yes, that was it. Thanks.

*** This issue has been marked as a duplicate of issue 16027 ***