It wasn't correct to use `g' here. Clang legitimately used sp-relative
memory locations, which broke really badly because the stack pointer
moves during the code sequence. Force the operands into registers to
avoid this problem.
{
unsigned ff;
__asm__ ("pushf; pushl %1; popf; pushf; popl %0; popf"
- : "=g" (ff)
- : "g" (f));
+ : "=r" (ff)
+ : "r" (f));
return (ff);
}
# else
{
unsigned long ff;
__asm__ ("pushf; pushq %1; popf; pushf; popq %0; popf"
- : "=g" (ff)
- : "g" (f));
+ : "=r" (ff)
+ : "r" (f));
return (ff);
}
# endif