[Issue 4524] Regression(2.026) Bus error with nested struct

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Sep 27 04:00:00 PDT 2010


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


Don <clugdbug at yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


--- Comment #3 from Don <clugdbug at yahoo.com.au> 2010-09-27 03:59:07 PDT ---
Caused by the fix to bug 2619. When setting the hidden pointer, the wrong
offset is used, which overwrites the return stack instead. Yikes.

e2ir.c, StructLiteralExp::toElem(), line 4849. Shouldn't be adjusting the
'this' pointer, because setEthis() does already adds ad->vthis->offset to it.
All tests in the test suite have v->offset == 0, so this wasn't noticed before.

------
    if (sd->isnested)
    {   // Initialize the hidden 'this' pointer
        assert(sd->fields.dim);
        Dsymbol *s = (Dsymbol *)sd->fields.data[sd->fields.dim - 1];
        ThisDeclaration *v = s->isThisDeclaration();
        assert(v);

        elem *e1;
        if (tybasic(stmp->Stype->Tty) == TYnptr)
        {   e1 = el_var(stmp);
            e1->EV.sp.Voffset = soffset;
        }
        else
        {   e1 = el_ptr(stmp);
            if (soffset)
                e1 = el_bin(OPadd, TYnptr, e1, el_long(TYsize_t, soffset));
        }
-        e1 = el_bin(OPadd, TYnptr, e1, el_long(TYsize_t, v->offset));
        e1 = setEthis(loc, irs, e1, sd);

        e = el_combine(e, e1);
    }

-- 
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