In the Linux kernel, we use assembly constructs (asm volatile) which trap or otherwise terminate execution. gcc doesn't know about this, so it doesn't terminate its flow analysis. These assembly constructs are more complex than a simple __builtin_trap(); will permit -- we have tried using assembly constructs in conjunction with __builtin_trap(); but that relies too much on undefined behaviour.
A much better solution would be to give us __builtin_not_reached(); which is simply an annotation truncating the flow of control at that point. You can think of it from an implementation perspective as __builtin_trap(); that doesn't actually generate any code. This allows any arbitrary assembly that truncates the flow of control to be annotated as such, without the overhead of a compiler-generated catch loop which is never actually reached. -- Summary: Request new feature __builtin_not_reached(); Product: gcc Version: unknown Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: hpa at zytor dot com GCC build triplet: All GCC host triplet: All GCC target triplet: All http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39252