[Issue 20089] New: FPU stack not cleaned up properly

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jul 27 17:03:50 UTC 2019


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

          Issue ID: 20089
           Summary: FPU stack not cleaned up properly
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Keywords: ice, wrong-code
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: r.sagitario at gmx.de

dmd's own test18772.d causes an ICE when dmd is built with assertions enabled.

float fun(cfloat z)
{
    return z.re;
}

void main()
{
    cfloat[1] A;
    float[1] B;
    int i = 0;
    double C = fun(A[i] * B[i]);
}

>dmd -m64 test18772.d
DMD v2.087.0
 DEBUG
stackused = 2

core.exception.AssertError at ..\dmd\backend\cgcod.d(694): Assertion failure

The assembly of the code when built with the release version shows the problem
is real:
  ...
  00000000000000CE: 48 8D 45 F8        lea         rax,[rbp-8]
  00000000000000D2: D9 04 98           fld         dword ptr [rax+rbx*4]
  00000000000000D5: D9 45 D0           fld         dword ptr [rbp-30h]
  00000000000000D8: D9 C9              fxch        st(1)
  00000000000000DA: D9 45 DA           fld         dword ptr [rbp-26h]
  00000000000000DD: D9 CA              fxch        st(2)
  00000000000000DF: D9 C9              fxch        st(1)
  00000000000000E1: DC CA              fmul        st(2),st
  00000000000000E3: DE C9              fmulp       st(1),st
  00000000000000E5: 48 83 EC 20        sub         rsp,20h
  00000000000000E9: E8 00 00 00 00     call        _D9test187723funFqZf
  00000000000000EE: 48 83 C4 20        add         rsp,20h
  00000000000000F2: F3 0F 5A C0        cvtss2sd    xmm0,xmm0
  ...

--


More information about the Digitalmars-d-bugs mailing list