https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85927
--- 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.