[Issue 6189] register content destroyed in function prolog

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jan 13 04:44:00 PST 2012


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



--- Comment #6 from dawg at dawgfoto.de 2012-01-13 04:43:54 PST ---
struct Point(T)
{
    T x, y;
}
alias Point!int IPoint;
alias Point!float FPoint;

void calcCoeffs(uint half, IPoint pos, ref FPoint[2] pts, uint=0)
{
    pos.x &= ~(half - 1);
    pos.y &= ~(half - 1);
    immutable float xo = pos.x;
    immutable float yo = pos.y;

    pts[0].x -= xo;
    pts[0].y -= yo;
    pts[1].x -= xo;
    pts[1].y -= yo;
}

void main()
{
    auto pos = IPoint(2, 2);
    FPoint[2] pts;
    pts[0] = pts[1] = FPoint(3, 3);
    auto f = &calcCoeffs;
    f(2, pos, pts);

    assert(pts[0].x == 1);
    assert(pts[0].y == 1);
    assert(pts[1].x == 1);
    assert(pts[1].y == 1);
}

----

This one happens with xmmregs too.

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