https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85927
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org, | |uros at gcc dot gnu.org --- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> --- The ud2 is there since naked has been implemented for x86 in PR25967. It is true it is a kind of debugging aid, so perhaps more suitable for sanitization or if we add some option to decide preferred behavior on e.g. __builtin_unreachable or for detected UB in the code (whether to use __builtin_unreachable with its current behavior, just assume it doesn't happen and don't emit anything in there, or whether to act as __builtin_trap etc.). But without it e.g. the reporter wouldn't know so easily the function is invalid and won't work correctly.