[Bug target/85927] ud2 instruction generated starting with gcc 8

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri May 25 21:36:00 GMT 2018


--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I don't see the issue with the ud2 instruction here.  The only valid thing is
for basic inline-asm statements in the functions which have the naked
attribute.  It is undefined if using anything besides basic inline-asm as
documented in the documentation.  ud2 is basically a trap to force the
developer to return from the function inside the basic inline-asm.  The
original code had two undefined issues:
1) Used extended inline-asm
2) Use C code

GCC decided it was just undefined at runtime rather to reject it at compile
time.  Unlike clang which decided to reject it at compile time.

More information about the Gcc-bugs mailing list