www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12862] New: [ICE] backend assertion (Internal error:

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

          Issue ID: 12862
           Summary: [ICE] backend assertion (Internal error:
                    backend/cg87.c 331) with inline, optimizing and floats
           Product: D
           Version: unspecified
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Keywords: ice, ice-on-valid-code
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: code dawg.eu

cat > bug.d << CODE
struct FRect
{
    float left, top, right, bottom;
}

void formatValue(float obj)
{
    static void byRef(ref float a) {}
    byRef(obj);
}

void formatValue(FRect val)
{
    formatValue(val.left);
    formatValue(val.top);
}

struct Foo
{
    void bug()
    {
        formatValue(bounds);
    }

     property FRect bounds()
    {
        if (&this !is null)
            return FRect();
        else
            return FRect();
    }
}
CODE

dmd -c -O -inline bug.d
----
Internal error: backend/cg87.c 331
----

The assertion is in
    STATIC code * makesure87(elem *e,unsigned offset,int i,unsigned flag)

    assert(_8087elems[i].e == NULL);

Debug output for the assertion is
    _8087elems[0].e = 0x1050968, .offset = 8

Looks like a place in the floating point stack is still occupied by some older
value. No idea how to fix this though.

--
Jun 05 2014