Jump to page: 1 2
Thread overview
[Issue 18573] std.algorithm each does not function correctly for assignment under x86
Mar 07, 2018
Matthew Gamble
Mar 07, 2018
Ketmar Dark
Mar 07, 2018
Ketmar Dark
Mar 07, 2018
Ketmar Dark
Mar 08, 2018
ag0aep6g@gmail.com
[Issue 18573] `cast(void)` leads to floating point return value not being popped from FPU stack
Mar 09, 2018
ag0aep6g@gmail.com
Feb 14, 2019
ag0aep6g
Feb 14, 2019
Walter Bright
[Issue 18573] cast(void) leads to floating point return value not being popped from FPU stack
Feb 15, 2019
Walter Bright
Feb 15, 2019
Walter Bright
Feb 15, 2019
Walter Bright
Feb 18, 2019
Dlang Bot
March 07, 2018
https://issues.dlang.org/show_bug.cgi?id=18573

Matthew Gamble <gamblemj@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|enhancement                 |normal

--
March 07, 2018
https://issues.dlang.org/show_bug.cgi?id=18573

Ketmar Dark <ketmar@ketmar.no-ip.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ketmar@ketmar.no-ip.org

--
March 07, 2018
https://issues.dlang.org/show_bug.cgi?id=18573

--- Comment #1 from Ketmar Dark <ketmar@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 */
}

--
March 07, 2018
https://issues.dlang.org/show_bug.cgi?id=18573

Ketmar Dark <ketmar@ketmar.no-ip.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|phobos                      |dmd
           Hardware|x86                         |All
                 OS|Windows                     |All

--- Comment #2 from Ketmar Dark <ketmar@ketmar.no-ip.org> ---
p.s.: as this bug affects x86_64 too (albeit only with `real`s), i changed arch
to all.

--
March 07, 2018
https://issues.dlang.org/show_bug.cgi?id=18573

Steven Schveighoffer <schveiguy@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schveiguy@yahoo.com

--
March 08, 2018
https://issues.dlang.org/show_bug.cgi?id=18573

ag0aep6g@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
                 CC|                            |ag0aep6g@gmail.com

--
March 09, 2018
https://issues.dlang.org/show_bug.cgi?id=18573

ag0aep6g@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|std.algorithm each does not |`cast(void)` leads to
                   |function correctly for      |floating point return value
                   |assignment under x86        |not being popped from FPU
                   |                            |stack

--
February 14, 2019
https://issues.dlang.org/show_bug.cgi?id=18573

ag0aep6g <ag0aep6g@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dkorpel@live.nl

--- Comment #3 from ag0aep6g <ag0aep6g@gmail.com> ---
*** Issue 19437 has been marked as a duplicate of this issue. ***

--
February 14, 2019
https://issues.dlang.org/show_bug.cgi?id=18573

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com

--- Comment #4 from Walter Bright <bugzilla@digitalmars.com> ---
The test case:

  real foo();

  void test1() {
    cast(void)foo();
  }

  void test2() {
    foo();
  }

compiles to:

  __D4test5test1FZv:
             call    __D4test3fooFZe
             ret

  __D4test5test2FZv:
             call    __D4test3fooFZe
             fstp    ST
             ret

which nicely illustrates the problem.

--
February 15, 2019
https://issues.dlang.org/show_bug.cgi?id=18573

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|`cast(void)` leads to       |cast(void) leads to
                   |floating point return value |floating point return value
                   |not being popped from FPU   |not being popped from FPU
                   |stack                       |stack

--
« First   ‹ Prev
1 2