[Bug target/103882] Register corruption in ASM only functions when optization is -O2/-Os/-O3
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Jan 2 13:27:41 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103882
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|WONTFIX |INVALID
--- Comment #14 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
There is no special case for inline asm as the whole body of a function (except
that __attribute__((naked)) functions need to contain just that), it acts like
any other inline asm. And like for any other inline asm, the user needs to
tell the compiler what side-effects it has.
You can define the whole function in top-level inline asm or in *.s/*.S file,
then the ABI applies for it.
Or just use the syscall function, see syscall(2) man page.
A hack that you want to propose (forcing noipa on functions that use inline
asm) certainly won't be accepted, that would penalize millions of correctly
written inline asm statements in real-world code. Even if it is limited only
to functions that contain just a single inline asm statement and nothing else.
Because even those are often desirable for inlining etc.
IPA RA is a very useful optimization, not something terrible.
And I've only spent last 23+ years working on GCC, so yes, I can't know the
codebase enough.
More information about the Gcc-bugs
mailing list