www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20089] New: FPU stack not cleaned up properly

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 puremagic.com
          Reporter: r.sagitario 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 ..\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 ... --
Jul 27 2019