https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103882

--- Comment #9 from Jose Silva <krystalgamer at protonmail dot com> ---
(In reply to Jakub Jelinek from comment #7)
> The compiler has no idea either (it has intentionally no idea what the
> inline asm does, it is a black box to the compiler), so that is why you need
> to specify it.  Look at C library sources, or kernel and find out what is
> and what isn't clobbered and add the clobbers.

It seems weird that GCC puts the sole responsibility on the programmer when
dealing with ASM. In my honest opinion, the compiler should be cautious when
interacting with hand-written ASM, the same way when interacting with function
pointers. 

It does allow for more optimization opportunities but it implies the programmer
knows a lot about the underlying architecture and system.



I'd like to implement a feature that automatically sets a function as noipa
when containing ASM statements, could you please point me in the codebase where
I could start?

Reply via email to