https://issues.dlang.org/show_bug.cgi?id=23200
Dennis <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #1 from Dennis <[email protected]> --- Removing the Phobos dependency: ``` static import core.math; pragma(inline, true) double sqrt(double x) @nogc @safe pure nothrow { return core.math.sqrt(x); } extern(C) void main() { double d = 9007199515875288.; auto r1 = cast (ulong) sqrt(d); auto r2 = cast (long) sqrt(d); assert (r1 == r2); } ``` It doesn't happen when calling core.math.sqrt directly, it looks like the problem manifests because of the inliner: ``` // output of -vcg-ast extern (C) extern (C) void main() { double d = 9.0072e+15; ulong r1 = cast(ulong)((double x = d;) , sqrt(x)); long r2 = cast(long)((double x = d;) , sqrt(x)); assert(r1 == cast(ulong)r2); return 0; } ``` It casts the comma expression to long/ulong, which may trip up the code generator. --
