https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104805
--- Comment #5 from 。 <570070308 at qq dot com> --- (In reply to Jakub Jelinek from comment #4) > rbp is hard frame pointer, so depending on whether the function needs a > frame pointer (at -O0 I think all functions do), the register isn't > available for use (and therefore for clobbering) in inline asm. > Only in functions where it isn't needed, it is not fixed then and can be > used for other purposes. So you explained why "rbp" cann't be in the clobber list with -O0, and may be can be in the clobber list with -O1,-O2 or -O3(when the function don't needs a frame pointer), I understand this now. But when the "rbp" is in the clobber list successfully, it should not be used to represent any input/output operands according to the doc because user may change the %rbp and make the input/output operands wrong. for example: ``` void kkk() { char a; __asm__ volatile ( "writing %%rbp\n\t" // %0 may point to error memory because %rbp change // for example -9(%rbp) represent char a "reading %0\n\t" "writing %0" :"+m"(a) : : "rsp","rbp" ); } ``` I have done a lot of experiments, if a register is list in the clobber list, it will never appear to represent in the input/output operands, and the doc say so too. Only "rbp" is an exception. https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html#Clobbers-and-Scratch-Registers ``` When the compiler selects which registers to use to represent input and output operands, it does not use any of the clobbered registers. As a result, clobbered registers are available for any use in the assembler code. ```