Avoid some -Wunreachable-code-ctrl
authorRichard Biener <rguenther@suse.de>
Mon, 29 Nov 2021 14:20:38 +0000 (15:20 +0100)
committerRichard Biener <rguenther@suse.de>
Tue, 30 Nov 2021 07:23:26 +0000 (08:23 +0100)
commit2acbc4eba33574a5e655c01d1be8b17fad0be535
treee5ed1acaf3d7f9ea3efeef6958dcf97acd35c702
parent6c7d489a1e6592bc73db03678c1231748fd7a126
Avoid some -Wunreachable-code-ctrl

This cleans up unreachable code diagnosed by -Wunreachable-code-ctrl.
It largely follows the previous series but discovers a few extra
cases, namely dead code after break or continue or loops without
exits.

2021-11-29  Richard Biener  <rguenther@suse.de>

gcc/c/
* gimple-parser.c (c_parser_gimple_postfix_expression):
avoid unreachable code after break.

gcc/
* cfgrtl.c (skip_insns_after_block): Refactor code to
be more easily readable.
* expr.c (op_by_pieces_d::run): Remove unreachable
assert.
* sched-deps.c (sched_analyze): Remove unreachable
gcc_unreachable.
* sel-sched-ir.c (in_same_ebb_p): Likewise.
* tree-ssa-alias.c (nonoverlapping_refs_since_match_p):
Remove unreachable code.
* tree-vect-slp.c (vectorize_slp_instance_root_stmt):
Refactor to avoid unreachable loop iteration.
* tree.c (walk_tree_1): Remove unreachable break.
* vec-perm-indices.c (vec_perm_indices::series_p): Remove
unreachable return.

gcc/cp/
* parser.c (cp_parser_postfix_expression): Remove
unreachable code.
* pt.c (tsubst_expr): Remove unreachable breaks.

gcc/fortran/
* frontend-passes.c (gfc_expr_walker): Remove unreachable
break.
* scanner.c (skip_fixed_comments): Remove unreachable
gcc_unreachable.
* trans-expr.c (gfc_expr_is_variable): Refactor to make
control flow more obvious.
14 files changed:
gcc/c/gimple-parser.c
gcc/cfgrtl.c
gcc/cp/parser.c
gcc/cp/pt.c
gcc/expr.c
gcc/fortran/frontend-passes.c
gcc/fortran/scanner.c
gcc/fortran/trans-expr.c
gcc/sched-deps.c
gcc/sel-sched-ir.c
gcc/tree-ssa-alias.c
gcc/tree-vect-slp.c
gcc/tree.c
gcc/vec-perm-indices.c