Remove more stray returns and gcc_unreachable ()s
authorRichard Biener <rguenther@suse.de>
Mon, 29 Nov 2021 12:19:57 +0000 (13:19 +0100)
committerRichard Biener <rguenther@suse.de>
Tue, 30 Nov 2021 14:05:12 +0000 (15:05 +0100)
This removes more cases that appear when bootstrap with
-Wunreachable-code-return progresses.

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

* config/i386/i386.c (ix86_shift_rotate_cost): Remove
unreachable return.
* tree-chrec.c (evolution_function_is_invariant_rec_p):
Likewise.
* tree-if-conv.c (if_convertible_stmt_p): Likewise.
* tree-ssa-pre.c (fully_constant_expression): Likewise.
* tree-vrp.c (operand_less_p): Likewise.
* reload.c (reg_overlap_mentioned_for_reload_p): Remove
unreachable gcc_unreachable ().
* sel-sched-ir.h (bb_next_bb): Likewise.
* varasm.c (compare_constant): Likewise.

gcc/cp/
* logic.cc (cnf_size_r): Remove unreachable and inconsistently
placed gcc_unreachable ()s.
* pt.c (iterative_hash_template_arg): Remove unreachable
gcc_unreachable and return.

gcc/fortran/
* target-memory.c (gfc_element_size): Remove unreachable return.

gcc/objc/
* objc-act.c (objc_build_setter_call): Remove unreachable
return.

libcpp/
* charset.c (convert_escape): Remove unreachable break.

13 files changed:
gcc/config/i386/i386.c
gcc/cp/logic.cc
gcc/cp/pt.c
gcc/fortran/target-memory.c
gcc/objc/objc-act.c
gcc/reload.c
gcc/sel-sched-ir.h
gcc/tree-chrec.c
gcc/tree-if-conv.c
gcc/tree-ssa-pre.c
gcc/tree-vrp.c
gcc/varasm.c
libcpp/charset.c

index 0e6bf3e..80fee62 100644 (file)
@@ -20366,7 +20366,6 @@ ix86_shift_rotate_cost (const struct processor_costs *cost,
       else
        return cost->shift_var;
     }
-  return cost->shift_const;
 }
 
 /* Compute a (partial) cost for rtx X.  Return true if the complete
index 9d892b1..f31ae8c 100644 (file)
@@ -495,7 +495,6 @@ cnf_size_r (tree t)
          else
            /* Neither LHS nor RHS is a conjunction.  */
            return std::make_pair (0, false);
-         gcc_unreachable ();
        }
       if (conjunction_p (lhs))
        {
@@ -536,7 +535,6 @@ cnf_size_r (tree t)
          else
            /* Neither LHS nor RHS is a conjunction.  */
            return std::make_pair (2, false);
-         gcc_unreachable ();
        }
       if (conjunction_p (lhs))
        {
index 6e25a38..f4b9d96 100644 (file)
@@ -1969,9 +1969,6 @@ iterative_hash_template_arg (tree arg, hashval_t val)
        val = iterative_hash_template_arg (TREE_OPERAND (arg, i), val);
       return val;
     }
-
-  gcc_unreachable ();
-  return 0;
 }
 
 /* Unregister the specialization SPEC as a specialization of TMPL.
index 7b21a9e..ab4665c 100644 (file)
@@ -138,7 +138,6 @@ gfc_element_size (gfc_expr *e, size_t *siz)
       *siz = 0;
       return false;
     }
-  return true;
 }
 
 
index 9baa46d..89f4629 100644 (file)
@@ -1904,9 +1904,6 @@ objc_build_setter_call (tree lhs, tree rhs)
                                         setter_argument, NULL);
       return setter;
     }
-
-  /* Unreachable, but the compiler may not realize.  */
-  return error_mark_node;
 }
 
 /* This hook routine is called when a MODIFY_EXPR is being built.  We
index 190db6a..9ee3439 100644 (file)
@@ -6602,11 +6602,10 @@ reg_overlap_mentioned_for_reload_p (rtx x, rtx in)
        return (rtx_equal_p (x, in)
                || reg_overlap_mentioned_for_reload_p (x, XEXP (in, 0))
                || reg_overlap_mentioned_for_reload_p (x, XEXP (in, 1)));
-      else return (reg_overlap_mentioned_for_reload_p (XEXP (x, 0), in)
-                  || reg_overlap_mentioned_for_reload_p (XEXP (x, 1), in));
+      else
+       return (reg_overlap_mentioned_for_reload_p (XEXP (x, 0), in)
+               || reg_overlap_mentioned_for_reload_p (XEXP (x, 1), in));
     }
-
-  gcc_unreachable ();
 }
 
 /* Return nonzero if anything in X contains a MEM.  Look also for pseudo
index 8ee0529..18e03c4 100644 (file)
@@ -1493,8 +1493,6 @@ bb_next_bb (basic_block bb)
     default:
       return bb->next_bb;
     }
-
-  gcc_unreachable ();
 }
 
 \f
index eeb67de..ad6f981 100644 (file)
@@ -1148,8 +1148,6 @@ evolution_function_is_invariant_rec_p (tree chrec, int loopnum)
     default:
       return false;
     }
-
-  return false;
 }
 
 /* Return true if CHREC is invariant in loop LOOPNUM, false otherwise. */
index d0ca046..1cc2016 100644 (file)
@@ -1110,8 +1110,6 @@ if_convertible_stmt_p (gimple *stmt, vec<data_reference_p> refs)
        }
       return false;
     }
-
-  return true;
 }
 
 /* Assumes that BB has more than 1 predecessors.
index 0669aaa..a49f87f 100644 (file)
@@ -1234,7 +1234,6 @@ fully_constant_expression (pre_expr e)
     default:
       return e;
     }
-  return e;
 }
 
 /* Translate the VUSE backwards through phi nodes in E->dest, so that
index dd77236..b3adc26 100644 (file)
@@ -330,8 +330,6 @@ operand_less_p (tree val, tree val2)
       else
        return -2;
     }
-
-  return 0;
 }
 
 /* Compare two values VAL1 and VAL2.  Return
index 8c7aba2..d6031d6 100644 (file)
@@ -3415,8 +3415,6 @@ compare_constant (const tree t1, const tree t2)
     default:
       return 0;
     }
-
-  gcc_unreachable ();
 }
 \f
 /* Return the section into which constant EXP should be placed.  */
index 0b0ccc6..bcfd3ad 100644 (file)
@@ -1534,7 +1534,6 @@ convert_escape (cpp_reader *pfile, const uchar *from, const uchar *limit,
     case 'x':
       return convert_hex (pfile, from, limit, tbuf, cvt,
                          char_range, loc_reader, ranges);
-      break;
 
     case '0':  case '1':  case '2':  case '3':
     case '4':  case '5':  case '6':  case '7':