[Issue 6877] New: [XMM] regression, clobbered float value

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Nov 1 16:05:18 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=6877

           Summary: [XMM] regression, clobbered float value
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: dawg at dawgfoto.de


--- Comment #0 from dawg at dawgfoto.de 2011-11-01 16:04:48 PDT ---
struct Matrix
{
    float[3][3] data;

    ref float[3] opIndex(size_t idx)
    {
        assert(0 <= idx && idx <= 2);
        return this.data[idx];
    }

    static Matrix identityMatrix()
    {
        Matrix id;
        id.data[0][0] = 1.0f; id.data[0][1] = 0.0f; id.data[0][2] = 0.0f;
        id.data[1][0] = 0.0f; id.data[1][1] = 1.0f; id.data[1][2] = 0.0f;
        id.data[2][0] = 0.0f; id.data[2][1] = 0.0f; id.data[2][2] = 1.0f;
        return id;
    }

    void setRotate(float deg)
    {
        this = identityMatrix();
        setSinCos(0.5f * deg, 0.2f * deg);
    }

    void setSinCos(float sinV, float cosV)
    {
        this[0][0] = cosV;
        this[0][1] = -sinV; // <- !!! BUG HERE BUG !!!

        // alternatively with this
        // *(cast(uint*)&(this[0][1])) = (*cast(uint*)&sinV) ^ 0x80000000;
        // thus it is not the OPneg that fails

        this[1][0] = sinV;
        this[1][1] = cosV;
    }
}

extern(C) int printf(in char* format, ...);

void main()
{
    Matrix m;
    m.setRotate(4);

    // should be -2
    printf("%g\n", m.data[0][1]);
}

---

Needed Flags: -O -inline, NOT -release, compilation with config.fpxmmregs

The is NaN where it should have been -2.
I could not reduce this test case any further.

This regression was introduced with:
https://github.com/D-Programming-Language/dmd/commit/82b5c12653c16097426ce990ecacc97525666302

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list