www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19748] New: [REG][wrong codegen] Returning 4 floats + DMD +

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

          Issue ID: 19748
           Summary: [REG][wrong codegen] Returning 4 floats + DMD + 64-bit
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: aliloko gmail.com

Consider this file:

------------------------ repro.d -------------------------

struct A
{
    float[4] array = [1, 2, 3, 4];
}

A _mm_add_ss(A a, A b) pure  safe
{
    a.array[0] += b.array[0];
    return a;
}

void main()
{
    A a;
    a = _mm_add_ss(a, a);

    // this assert fails, content is [1, 2, 3, 4] instead
    // This is a 2.085.0 regression
    assert(a.array == [2.0f, 2, 3, 4]); 
}

-----------------------------------------------------------


Build with DMD 2.085.0 on Windows:

$ dmd repro.d -O -inline -noboundscheck -m64 -inline -release -unittest
$ repro.exe

The assert fails, but it works in DMD 2.084.1

--
Mar 17 2019