[Bug inline-asm/87984] [7/8/9 Regression] wrong code for local reg var input to asm
amonakov at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Nov 12 20:18:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87984
--- Comment #9 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
Actually, no long division needed, broken with a plain move as well:
__attribute__((weak))
int f(void)
{
int o=0, i;
for (i=0; i<3; i++) {
register int a asm("eax");
a = 1;
asm("add %1, %0" : "+r"(o) : "r"(a));
asm("xor %%eax, %%eax" ::: "eax");
}
return o;
}
int main()
{
if (f() != 3)
__builtin_abort();
return 0;
}
More information about the Gcc-bugs
mailing list