[Bug c++/46476] Missing Warning about unreachable code after return [-Wunreachable-code-return]

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Nov 29 14:29:49 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46476

--- Comment #29 from Richard Biener <rguenth at gcc dot gnu.org> ---
Created attachment 51895
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51895&action=edit
-Wunreachable-code-ctrl at GIMPLE lowering time

This is the -Wunreachable-code-ctrl (not enabled by -Wextra) patch diagnosing
unreachable stmts after a break, continue, goto (or loops without exit via the
backedge goto).

Note that unlike clang which seems to model the option names after what kind
of stmt is detected as unreachable these patches model the option names
after what kind of stmt makes other stmts unreachable.  Not sure what is more
useful in practice [to avoid coding-style issues].


More information about the Gcc-bugs mailing list