https://issues.dlang.org/show_bug.cgi?id=20363
Issue ID: 20363
Summary: optimization with union, >> and ulong leads to wrong
result
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
auto test(double val)
{
union A
{
double a;
ulong b;
}
A fb;
fb.a = val;
auto sgn = ((fb.b >> 63) & 1) ? "-" : "+";
import std.stdio;
writeln(sgn);
}
void main()
{
test(-double.nan);
}
When running this with "rdmd -O" I get "+" not the expected "-". Without the -O
flag it works.
--