https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118549
Sam James <sjames at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED CC| |bruno at clisp dot org Assignee|unassigned at gcc dot gnu.org |sjames at gcc dot gnu.org --- Comment #9 from Sam James <sjames at gcc dot gnu.org> --- This came up in https://lists.gnu.org/archive/html/bug-gnulib/2025-02/msg00024.html too: """ [...] 1) ISO C 23 ยง 7.21.1.(3) is clear that it's undefined behaviour. This is also what gcc does with the usual optimization options: It produces no instruction at all, leaving the CPU to execute whatever instruction may follow. It's documented in <https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html> but you can see it directly: compile this code with "gcc -m32 -O2 -S": ----------------------------------------------------- void foo (void) { __builtin_unreachable(); } ----------------------------------------------------- Even with the option -funreachable-traps of GCC >= 13, documented in <https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html>, it produces zero instructions, not even a trap. (See: compile the code above with "gcc -m64 -funreachable-traps -S"). [...] """ so I think there's a clear case for refining the documentation. I'll put it on my list.