https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82221
H.J. Lu <hjl.tools at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hjl.tools at gmail dot com, | |ubizjak at gmail dot com --- Comment #5 from H.J. Lu <hjl.tools at gmail dot com> --- The problem is static inline __attribute__((always_inline)) unsigned long long paravirt_read_pmc(int counter) { return ({ u64 __ret; unsigned long __eax = __eax, __edx = __edx; { asm volatile("# foo" : "=a" (__eax), "=d" (__edx) : "a" ((unsigned long)(counter)) : "memory", "cc", "sp" ); ^^^^^^^ with -mpreferred-stack-boundary=2 __ret = (u64)((((u64)__edx) << 32) | __eax); } __ret; }); } On one hand, GCC needs BP register to align the stack for static inline __attribute__((always_inline,unused)) __attribute__((no_instrument_function)) long long bar(atomic64_t *v, long long o, long long n) { return ((__typeof__(*(&v->counter)))__bar((&v->counter), (unsigned long long)(o ), (unsigned long long)(n))); } On the other hand, GCC needs BP register to preserve SP since asm statement in paravirt_read_pmc clobbers SP. I think it is a user error. But GCC should provide a better error message.