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


Don <clugd...@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[64 bit] Wrong code         |[64 bit] Wrong code
                   |generation with ref         |generation with spilled
                   |parameters, -m64 -O         |register, -m64 -O


--- Comment #4 from Don <clugd...@yahoo.com.au> 2012-05-16 01:43:57 PDT ---
A little further reduced. Doesn't need ref. The complicated thing about this
test case is the third parameter, which goes into EDX. The two divisions, one
in each section, prevent any variable from being stored in RDX. Probably there
is some simpler way of forcing it to run out of registers.

Compiling with --r gives the message:

symbol 'z' spilled in reg R9

and this is where the problem happens.
edx must be the third last parameter, since RDX is used in the division. All
the other parameters (and hence registers) can be shuffled around.

---------------------------
void bug8095(int p0, int *p1, int z, int edx, int *p4, int p5)
{
    int x = z / 3;
    if (z) {
        int c = p5 + *p1 + p0; // *p1 segfaults -- it does *z !!
        if ( z / 5 )
            c = 1;
        *p4 = c;
        x = c;
    }
    void never_used() {
        ++x;
        int * unused = p1; // kills p4 somehow
    }
}

void main() {
    int x, y;
    bug8095(0, &x, 1, 0, &y, 0);
}

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

Reply via email to