[Issue 18573] std.algorithm each does not function correctly for assignment under x86

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Mar 7 22:05:11 UTC 2018


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

--- Comment #1 from Ketmar Dark <ketmar at ketmar.no-ip.org> ---
some clarification: basically, this boils down to codegen bug: if we have
function that returns some floating point value, and FPU is involved, and
caller does `cast(void)myfunc()`, result is not popped from FPU stack.

note that `cast(void)` is vital here: everything is ok without it. also, as
X86_64 doesn't use FPU for floats and doubled, you need to use `real` there to
trigger the bug.

minified sample by ag0aep6g:

double f() { return 1; }
void main()
{
    cast(void) f();
    cast(void) f();
    cast(void) f();
    cast(void) f();
    cast(void) f();
    cast(void) f();
    cast(void) f();

    double b = 2;
    assert(b == 2); /* fails; should pass */
}

--


More information about the Digitalmars-d-bugs mailing list