https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87984

--- Comment #17 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
Well, the asm with the xor was just to make the testcase more-obviously-broken,
it's still broken when %eax is clobbered in a more subtle way, like via a
libcall for integer division like in earlier examples, or simply by calling an
external function:

extern int clear_eax(void);

static inline void
ff(int *o)
{
    register int a asm("eax");
    a = 1;
    asm("add %1, %0" : "+g"(*o) : "r"(a));
}

int f(void)
{
    int o=0, i;
    for (i=0; i<3; i++) {
        ff(&o);
        clear_eax();
    }
    return o;
}

Reply via email to