On Wed, Dec 12, 2018 at 06:26:10PM +0200, Dimitar Dimitrov wrote: > I expect that if I mark a HW register as "clobber", compiler would save its > contents before executing the asm statement, and after that it would restore > its contents. This is the GCC behaviour for all but the SP and PIC registers. > That is why I believe that PR52813 is a valid bug.
It won't do it for *any* fixed registers. But you do not want to error or even warn for some fixed registers, for example the "flags" register on x86 is *always* written to by asm. But you never want to warn for non-fixed registers, and e.g. PIC_OFFSET_TABLE_REGNUM isn't always a fixed register (when flag_pic is 0 for example). > I'm not sure how GCC could recover if SP is clobbered. If SP is clobbered in > such a way that GCC will not notice (e.g. thread switching), then why should > GCC know about it in the first place? Up until today, GCC has always just ignored it if you claimed to clobber the stack pointer. Segher