[PATCH] Remove dead stores and initializations

Markus Trippelsdorf markus@trippelsdorf.de
Thu Mar 16 12:31:00 GMT 2017


clang --analyze pointed out a number of dead stores and initializations.

Tested on ppc64le. Ok for trunk?

Thanks.

gcc/c-family/ChangeLog:

	* c-ada-spec.c (to_ada_name): Remove dead store.

gcc/c/ChangeLog:

	* c-array-notation.c (build_array_notation_expr): Remove dead stores.
	* c-parser.c (c_parser_objc_try_catch_finally_statement): Remove dead
	initialization.
	(c_parser_oacc_wait_list): Remove dead store.
	(c_parser_oacc_clause_tile): Remove dead initialization.

gcc/cp/ChangeLog:

	* class.c (adjust_clone_args): Remove dead store.
	* constexpr.c (potential_constant_expression_1): Likewise.
	* cp-array-notation.c (expand_an_in_modify_expr): Likewise.
	(expand_unary_array_notation_exprs): Likewise.
	* decl.c (check_goto): Likewise.
	(check_initializer): Remove dead initialization.
	(cp_finish_decomp): Remove dead store.
	(compute_array_index_type): Likewise.
	(grokdeclarator): Likewise.
	* decl2.c (import_export_decl): Likewise.
	* optimize.c (maybe_clone_body): Likewise.
	* search.c (lookup_field_1): Likewise.
	* typeck.c (cxx_sizeof_or_alignof_type): Likewise.
	(convert_for_initialization): Likewise.

gcc/ChangeLog:

	* asan.c (asan_emit_stack_protection): Remove dead store. 
	* bt-load.c (move_btr_def): Likewise.
	* builtins.c (expand_builtin_apply_args_1): Likewise.
	(expand_builtin_apply): Likewise.
	* calls.c (expand_call): Likewise.
	(emit_library_call_value_1): Likewise.
	* cfgexpand.c (expand_asm_stmt): Likewise.
	* cfghooks.c (verify_flow_info): Likewise.
	* cfgloopmanip.c (remove_path): Likewise.
	* cfgrtl.c (rtl_verify_bb_layout): Remove dead initialization.
	* cilk-common.c (get_frame_arg): Remove dead store.
	* combine.c (simplify_if_then_else): Likewise.
	(simplify_comparison): Likewise.
	* config/i386/i386.c (choose_baseaddr): Likewise.
	(ix86_expand_int_movcc): Likewise.
	(ix86_expand_vec_perm): Likewise. 
	(ix86_expand_set_or_movmem): Likewise.
	(ix86_preferred_output_reload_class): Likewise.
	(expand_vec_perm_palignr): Likewise.
	* cselib.c (cselib_expand_value_rtx_1): Likewise.
	(cselib_record_sets): Likewise.
	* dojump.c (do_jump_by_parts_greater_rtx): Likewise.
	* dwarf2out.c (loc_list_from_tree_1): Likewise.
	* final.c (shorten_branches): Likewise.
	* gengtype.c (read_input_list): Remove dead initialization.
	* gimplify.c (gimplify_function_tree): Remove dead store.
	* ipa-chkp.c (chkp_maybe_create_clone): Likewise.
	* ipa-inline-analysis.c (account_size_time): Likewise.
	* ipa-prop.c (ipa_make_edge_direct_to_target): Remove dead
	initialization.
	* ira-color.c (setup_profitable_hard_regs): Remove dead store
	(color_pass): Likewise.
	* ira.c (rtx_moveable_p): Likewise.
	* lra-eliminations.c (eliminate_regs_in_insn): Likewise.
	* lra.c (collect_non_operand_hard_regs): Remove dead initialization.
	(lra_set_insn_recog_data): Likewise.
	* reg-stack.c (check_asm_stack_operands): Remove dead store.
	* regrename.c (regrename_analyze): Move initialization out of loop.
	(scan_rtx): Remove dead store.
	* reorg.c (fill_slots_from_thread): Remove dead initialization.
	* sel-sched.c (moveup_expr): Remove dead store.
	* tree-inline.c (copy_bb): Likewise.
	(tree_function_versioning): Likewise.
	* tree-parloops.c (ref_conflicts_with_region): Remove dead
	initialization.
	* tree-ssa-loop-ivcanon.c (tree_unroll_loops_completely): Remove 
	dead store.
	* tree-ssa-loop-niter.c (number_of_iterations_lt_to_ne): Remove dead
	initialization.
	* tree-ssa-phionlycprop.c (pass_phi_only_cprop::execute): Remove 
	dead store.
	* tree-ssa-structalias.c (solve_graph): Likewise.
	* tree-ssa-threadedge.c (thread_across_edge): Likewise.
	* tree-vect-loop-manip.c (vect_do_peeling): Remove dead
	initialization.
	* tree-vect-loop.c (get_initial_def_for_induction): Likewise.
	(vect_create_epilog_for_reduction): Likewise.
	* tree-vect-slp.c (vect_analyze_slp_instance): Likewise.
	* varasm.c (output_constructor_regular_field): Remove dead store.

diff --git a/gcc/asan.c b/gcc/asan.c
index edcc6ea5a913..207e29341614 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -1342,7 +1342,6 @@ asan_emit_stack_protection (rtx base, rtx pbase, unsigned int alignb,
 		= shadow_mem_size (current_offset - last_offset + rounded_size);
 	      shadow_mem = adjust_address (shadow_mem, VOIDmode, shift);
 	      last_offset = var_offset + rounded_size;
-	      current_offset = last_offset;
 	    }
 
 	}
diff --git a/gcc/bt-load.c b/gcc/bt-load.c
index 27be6a382c47..d908ac144f88 100644
--- a/gcc/bt-load.c
+++ b/gcc/bt-load.c
@@ -1170,7 +1170,6 @@ move_btr_def (basic_block new_def_bb, int btr, btr_def *def, bitmap live_range,
 
   if (def->other_btr_uses_before_def)
     {
-      insp = BB_END (b);
       for (insp = BB_END (b); ! INSN_P (insp); insp = PREV_INSN (insp))
 	gcc_assert (insp != BB_HEAD (b));
 
diff --git a/gcc/builtins.c b/gcc/builtins.c
index f3bee5bfc1af..6eaffb0f02b4 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -1507,11 +1507,8 @@ expand_builtin_apply_args_1 (void)
   /* Save the structure value address unless this is passed as an
      "invisible" first argument.  */
   if (struct_incoming_value)
-    {
-      emit_move_insn (adjust_address (registers, Pmode, size),
+    emit_move_insn (adjust_address (registers, Pmode, size),
 		      copy_to_reg (struct_incoming_value));
-      size += GET_MODE_SIZE (Pmode);
-    }
 
   /* Return the address of the block.  */
   return copy_addr_to_reg (XEXP (registers, 0));
@@ -1660,7 +1657,6 @@ expand_builtin_apply (rtx function, rtx arguments, rtx argsize)
       emit_move_insn (struct_value, value);
       if (REG_P (struct_value))
 	use_reg (&call_fusage, struct_value);
-      size += GET_MODE_SIZE (Pmode);
     }
 
   /* All arguments and registers used for the call are set up by now!  */
diff --git a/gcc/c-family/c-ada-spec.c b/gcc/c-family/c-ada-spec.c
index 18c5ccf1054e..a2e13266787e 100644
--- a/gcc/c-family/c-ada-spec.c
+++ b/gcc/c-family/c-ada-spec.c
@@ -1151,7 +1151,6 @@ to_ada_name (const char *name, int *space_found)
 	{
 	  s[len2++] = 'c';
 	  s[len2++] = '_';
-	  found = true;
 	  break;
 	}
 
diff --git a/gcc/c/c-array-notation.c b/gcc/c/c-array-notation.c
index 4c6651ea29c3..7463e1ea2802 100644
--- a/gcc/c/c-array-notation.c
+++ b/gcc/c/c-array-notation.c
@@ -700,7 +700,6 @@ build_array_notation_expr (location_t location, tree lhs, tree lhs_origtype,
 	  return NULL_TREE;
 	}
     }
-  rhs_list_size = 0;
   rhs_list = NULL;
   extract_array_notation_exprs (rhs, true, &rhs_list);
   extract_array_notation_exprs (lhs, true, &lhs_list);
@@ -814,7 +813,6 @@ build_array_notation_expr (location_t location, tree lhs, tree lhs_origtype,
       lhs_array_operand = create_array_refs
 	(location, lhs_an_info, lhs_an_loop_info, lhs_list_size, lhs_rank);
       replace_array_notations (&lhs, true, lhs_list, lhs_array_operand);
-      array_expr_lhs = lhs;
     }
   if (rhs_array_operand)
     vec_safe_truncate (rhs_array_operand, 0);
diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index 5bc238b46172..f5ef65b6cdcd 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -9547,7 +9547,7 @@ c_parser_objc_try_catch_finally_statement (c_parser *parser)
   while (c_parser_next_token_is_keyword (parser, RID_AT_CATCH))
     {
       struct c_parm *parm;
-      tree parameter_declaration = error_mark_node;
+      tree parameter_declaration;
       bool seen_open_paren = false;
 
       c_parser_consume_token (parser);
@@ -10696,7 +10696,6 @@ c_parser_oacc_wait_list (c_parser *parser, location_t clause_loc, tree list)
 	  if (!INTEGRAL_TYPE_P (TREE_TYPE (targ)))
 	    {
 	      c_parser_error (parser, "expression must be integral");
-	      targ = error_mark_node;
 	    }
 	  else
 	    {
@@ -11915,7 +11914,7 @@ c_parser_oacc_clause_async (c_parser *parser, tree list)
 static tree
 c_parser_oacc_clause_tile (c_parser *parser, tree list)
 {
-  tree c, expr = error_mark_node;
+  tree c, expr;
   location_t loc;
   tree tile = NULL_TREE;
 
diff --git a/gcc/calls.c b/gcc/calls.c
index 61caf4ca752c..4cd1f0a07ed0 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -3540,7 +3540,6 @@ expand_call (tree exp, rtx target, int ignore)
 		    memset (&stack_usage_map[initial_highest_arg_in_use], 0,
 			   (highest_outgoing_arg_in_use
 			    - initial_highest_arg_in_use));
-		  needed = 0;
 
 		  /* The address of the outgoing argument list must not be
 		     copied to a register here, because argblock would be left
@@ -4701,7 +4700,6 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
       if (initial_highest_arg_in_use != highest_outgoing_arg_in_use)
 	memset (&stack_usage_map[initial_highest_arg_in_use], 0,
 	       highest_outgoing_arg_in_use - initial_highest_arg_in_use);
-      needed = 0;
 
       /* We must be careful to use virtual regs before they're instantiated,
 	 and real regs afterwards.  Loop optimization, for example, can create
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 66af69973c69..8dc6b999185a 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -2918,7 +2918,6 @@ expand_asm_stmt (gasm *stmt)
 	      }
 	}
     }
-  unsigned nclobbers = clobber_rvec.length();
 
   /* First pass over inputs and outputs checks validity and sets
      mark_addressable if needed.  */
@@ -3141,7 +3140,7 @@ expand_asm_stmt (gasm *stmt)
   gcc_assert (constraints.length() == noutputs + ninputs);
 
   /* But it certainly can adjust the clobbers.  */
-  nclobbers = clobber_rvec.length();
+  unsigned nclobbers = clobber_rvec.length();
 
   /* Third pass checks for easy conflicts.  */
   /* ??? Why are we doing this on trees instead of rtx.  */
diff --git a/gcc/cfghooks.c b/gcc/cfghooks.c
index ce2da6a2f39c..6781443a3f7f 100644
--- a/gcc/cfghooks.c
+++ b/gcc/cfghooks.c
@@ -248,8 +248,6 @@ verify_flow_info (void)
 	err = 1;
       }
 
-  last_bb_seen = ENTRY_BLOCK_PTR_FOR_FN (cfun);
-
   /* Clean up.  */
   free (last_visited);
   free (edge_checksum);
diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c
index 3e34aadd6911..e9de0186fe69 100644
--- a/gcc/cfgloopmanip.c
+++ b/gcc/cfgloopmanip.c
@@ -364,7 +364,6 @@ remove_path (edge e, bool *irred_invalidated,
 
   for (i = 0; i < nrem; i++)
     {
-      bb = rem_bbs[i];
       FOR_EACH_EDGE (ae, ei, rem_bbs[i]->succs)
 	if (ae->dest != EXIT_BLOCK_PTR_FOR_FN (cfun)
 	    && !bitmap_bit_p (seen, ae->dest->index))
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index cafa38d35b05..48bfa5cebf24 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -2911,7 +2911,7 @@ rtl_verify_bb_layout (void)
   rtx_insn *x;
   int num_bb_notes;
   rtx_insn * const rtx_first = get_insns ();
-  basic_block last_bb_seen = ENTRY_BLOCK_PTR_FOR_FN (cfun), curr_bb = NULL;
+  basic_block last_bb_seen, curr_bb = NULL;
 
   num_bb_notes = 0;
   last_bb_seen = ENTRY_BLOCK_PTR_FOR_FN (cfun);
diff --git a/gcc/cilk-common.c b/gcc/cilk-common.c
index 46626b75b23a..abcde3e4b8f3 100644
--- a/gcc/cilk-common.c
+++ b/gcc/cilk-common.c
@@ -322,8 +322,6 @@ get_frame_arg (tree call)
   argtype = TREE_TYPE (arg);
   gcc_assert (TREE_CODE (argtype) == POINTER_TYPE);
 
-  argtype = TREE_TYPE (argtype);
-  
   /* If it is passed in as an address, then just use the value directly 
      since the function is inlined.  */
   if (TREE_CODE (arg) == ADDR_EXPR)
diff --git a/gcc/combine.c b/gcc/combine.c
index 66215a607bd9..d151fcc1cf43 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -6344,7 +6344,6 @@ simplify_if_then_else (rtx x)
 	  || reg_mentioned_p (true_rtx, false_rtx)
 	  || rtx_equal_p (false_rtx, XEXP (cond, 0))))
     {
-      true_code = reversed_comparison_code (cond, NULL);
       SUBST (XEXP (x, 0), reversed_comparison (cond, GET_MODE (cond)));
       SUBST (XEXP (x, 1), false_rtx);
       SUBST (XEXP (x, 2), true_rtx);
@@ -11944,7 +11943,6 @@ simplify_comparison (enum rtx_code code, rtx *pop0, rtx *pop1)
 
 	      op0 = XEXP (op0, 2);
 	      op1 = GEN_INT (i);
-	      const_op = i;
 
 	      /* Result is nonzero iff shift count is equal to I.  */
 	      code = reverse_condition (code);
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index f58d529604c4..0936ba0cf81d 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -12716,7 +12716,6 @@ choose_baseaddr (HOST_WIDE_INT cfa_offset)
 	    {
 	      base_reg = hard_frame_pointer_rtx;
 	      base_offset = toffset;
-	      len = tlen;
 	    }
 	}
     }
@@ -23169,8 +23168,6 @@ ix86_expand_int_movcc (rtx operands[])
   compare_seq = get_insns ();
   end_sequence ();
 
-  compare_code = GET_CODE (compare_op);
-
   if ((op1 == const0_rtx && (code == GE || code == LT))
       || (op1 == constm1_rtx && (code == GT || code == LE)))
     sign_bit_compare_p = true;
@@ -23218,7 +23215,6 @@ ix86_expand_int_movcc (rtx operands[])
 	      if (compare_code == LTU)
 		{
 		  std::swap (ct, cf);
-		  compare_code = reverse_condition (compare_code);
 		  code = reverse_condition (code);
 		}
 	      else
@@ -23536,7 +23532,6 @@ ix86_expand_int_movcc (rtx operands[])
 	      if (compare_code == GE || !cf)
 		{
 		  code = reverse_condition (code);
-		  compare_code = LT;
 		}
 	      else
 		std::swap (ct, cf);
@@ -25045,7 +25040,7 @@ ix86_expand_vec_perm (rtx operands[])
 				        const2_rtx, const2_rtx));
 	  mask = t3;
 	  maskmode = V4SImode;
-	  e = w = 4;
+	  w = 4;
 	}
 
       for (i = 0; i < w; i++)
@@ -27862,7 +27857,6 @@ ix86_expand_set_or_movmem (rtx dst, rtx src, rtx count_exp, rtx val_exp,
 				     count_exp, -align_bytes);
 	  count -= align_bytes;
 	  min_size -= align_bytes;
-	  max_size -= align_bytes;
 	}
       if (need_zero_guard
 	  && min_size < (unsigned HOST_WIDE_INT) size_needed
@@ -39898,7 +39892,6 @@ ix86_preferred_output_reload_class (rtx x, reg_class_t regclass)
   /* Restrict the output reload class to the register bank that we are doing
      math on.  If we would like not to return a subset of CLASS, reject this
      alternative: if reload cannot do this, it will still use its choice.  */
-  mode = GET_MODE (x);
   if (SSE_FLOAT_MODE_P (mode) && TARGET_SSE_MATH)
     return MAYBE_SSE_CLASS_P (regclass) ? ALL_SSE_REGS : NO_REGS;
 
@@ -46724,7 +46717,6 @@ expand_vec_perm_palignr (struct expand_vec_perm_d *d, bool single_insn_only_p)
 	return false;
       swap = true;
       min = minswap;
-      max = maxswap;
     }
 
   /* Given that we have SSSE3, we know we'll be able to implement the
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 9e4b4c4fd326..5f2f5667e606 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -4961,8 +4961,6 @@ adjust_clone_args (tree decl)
       tree orig_decl_parms = TYPE_ARG_TYPES (TREE_TYPE (decl));
       tree decl_parms, clone_parms;
 
-      clone_parms = orig_clone_parms;
-
       /* Skip the 'this' parameter.  */
       orig_clone_parms = TREE_CHAIN (orig_clone_parms);
       orig_decl_parms = TREE_CHAIN (orig_decl_parms);
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index 2510e23e61bb..bd05dbad2acd 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -5153,7 +5153,6 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict,
 	    /* Skip initial arguments to base constructors.  */
 	    if (DECL_BASE_CONSTRUCTOR_P (fun))
 	      i = num_artificial_parms_for (fun);
-	    fun = DECL_ORIGIN (fun);
 	  }
 	else if (fun)
           {
diff --git a/gcc/cp/cp-array-notation.c b/gcc/cp/cp-array-notation.c
index 36d66245224f..b953e6a41f45 100644
--- a/gcc/cp/cp-array-notation.c
+++ b/gcc/cp/cp-array-notation.c
@@ -679,7 +679,6 @@ expand_an_in_modify_expr (location_t location, tree lhs,
 	 goto error;
      }
   replace_array_notations (&rhs, true, rhs_list, rhs_array_operand);
-  rhs_list_size = 0;
   rhs_list = NULL;
   extract_array_notation_exprs (rhs, true, &rhs_list);
   rhs_list_size = vec_safe_length (rhs_list);    
@@ -1010,7 +1009,6 @@ expand_unary_array_notation_exprs (tree orig_stmt)
   else
     stmt = orig_stmt;
   rank = 0;
-  list_size = 0;
   array_list = NULL;
   extract_array_notation_exprs (stmt, true, &array_list);
   list_size = vec_safe_length (array_list);
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 0ecd30b691b0..29f844040460 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -3381,12 +3381,9 @@ check_goto (tree decl)
 	  if (b->kind == sk_omp)
 	    {
 	      if (identified < 2)
-		{
-		  complained = identify_goto (decl,
-					      DECL_SOURCE_LOCATION (decl),
-					      &input_location, DK_ERROR);
-		  identified = 2;
-		}
+		complained = identify_goto (decl,
+					    DECL_SOURCE_LOCATION (decl),
+					    &input_location, DK_ERROR);
 	      if (complained)
 		inform (input_location, "  exits OpenMP structured block");
 	      break;
@@ -6180,7 +6177,7 @@ build_aggr_init_full_exprs (tree decl, tree init, int flags)
 static tree
 check_initializer (tree decl, tree init, int flags, vec<tree, va_gc> **cleanups)
 {
-  tree type = TREE_TYPE (decl);
+  tree type;
   tree init_code = NULL;
   tree core_type;
 
@@ -7601,11 +7598,8 @@ cp_finish_decomp (tree decl, tree first, unsigned int count)
 	goto cnt_mismatch;
       tree t = dexp;
       if (type != btype)
-	{
-	  t = convert_to_base (t, btype, /*check_access*/true,
-			       /*nonnull*/false, tf_warning_or_error);
-	  type = btype;
-	}
+	t = convert_to_base (t, btype, /*check_access*/true,
+			     /*nonnull*/false, tf_warning_or_error);
       unsigned int i = 0;
       for (tree field = TYPE_FIELDS (btype); field; field = TREE_CHAIN (field))
 	if (TREE_CODE (field) != FIELD_DECL || DECL_ARTIFICIAL (field))
@@ -9415,7 +9409,6 @@ compute_array_index_type (tree name, tree size, tsubst_flags_t complain)
 	  else
 	    error ("size of array has non-integral type %qT", type);
 	  size = integer_one_node;
-	  type = TREE_TYPE (size);
 	}
     }
 
@@ -12259,10 +12252,7 @@ grokdeclarator (const cp_declarator *declarator,
 	      }
 
 	    if (invalid_static)
-	      {
-		staticp = 0;
-		storage_class = sc_none;
-	      }
+	      storage_class = sc_none;
 	  }
       }
     else
@@ -12292,7 +12282,6 @@ grokdeclarator (const cp_declarator *declarator,
 	      {
 		permerror (input_location, "%<static%> may not be used when defining "
 			   "(as opposed to declaring) a static data member");
-		staticp = 0;
 		storage_class = sc_none;
 	      }
 	    if (storage_class == sc_register && TREE_STATIC (decl))
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index b50fadf050db..5475319dd7fd 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -2876,7 +2876,6 @@ import_export_decl (tree decl)
       tree type = TREE_TYPE (DECL_NAME (decl));
       if (CLASS_TYPE_P (type))
 	{
-	  class_type = type;
 	  import_export_class (type);
 	  if (CLASSTYPE_INTERFACE_KNOWN (type)
 	      && TYPE_POLYMORPHIC_P (type)
diff --git a/gcc/cp/optimize.c b/gcc/cp/optimize.c
index d646ef73803f..8b1a47f652a0 100644
--- a/gcc/cp/optimize.c
+++ b/gcc/cp/optimize.c
@@ -668,7 +668,6 @@ maybe_clone_body (tree fn)
 	}
       else
 	expand_or_defer_fn (clone);
-      first = false;
     }
   pop_from_top_level ();
 
diff --git a/gcc/cp/search.c b/gcc/cp/search.c
index 09c1b4e6456d..617fe1df3bb3 100644
--- a/gcc/cp/search.c
+++ b/gcc/cp/search.c
@@ -435,8 +435,6 @@ lookup_field_1 (tree type, tree name, bool want_type)
       return NULL_TREE;
     }
 
-  field = TYPE_FIELDS (type);
-
   if (GATHER_STATISTICS)
     n_calls_lookup_field_1++;
 
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index d1111248dc70..480dd7b686c2 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -1571,7 +1571,6 @@ cxx_sizeof_or_alignof_type (tree type, enum tree_code op, bool complain)
 		 operator_name_info[(int) op].name);
       else
 	return error_mark_node;
-      value = size_one_node;
     }
 
   dependent_p = dependent_type_p (type);
@@ -8674,8 +8673,6 @@ convert_for_initialization (tree exp, tree type, tree rhs, int flags,
   if (exp == error_mark_node)
     return error_mark_node;
 
-  rhstype = non_reference (rhstype);
-
   type = complete_type (type);
 
   if (DIRECT_INIT_EXPR_P (type, rhs))
diff --git a/gcc/cselib.c b/gcc/cselib.c
index a621f0da956e..2e59b9da04b0 100644
--- a/gcc/cselib.c
+++ b/gcc/cselib.c
@@ -1769,7 +1769,6 @@ cselib_expand_value_rtx_1 (rtx orig, struct expand_value_data *evd,
      have a mode and the mode isn't derivable from whole rtx's mode,
      try simplify_*_operation first with mode from original's operand
      and as a fallback wrap CONST_INT into gen_rtx_CONST.  */
-  scopy = copy;
   switch (GET_RTX_CLASS (code))
     {
     case RTX_UNARY:
@@ -2470,7 +2469,6 @@ cselib_record_sets (rtx_insn *insn)
   int n_sets_before_autoinc;
   struct cselib_record_autoinc_data data;
 
-  body = PATTERN (insn);
   if (GET_CODE (body) == COND_EXEC)
     {
       cond = COND_EXEC_TEST (body);
diff --git a/gcc/dojump.c b/gcc/dojump.c
index b45bba3ac376..cbad94abf3dd 100644
--- a/gcc/dojump.c
+++ b/gcc/dojump.c
@@ -701,7 +701,6 @@ do_jump_by_parts_greater_rtx (machine_mode mode, int unsignedp, rtx op0,
       code = LE;
       if_true_label = if_false_label;
       if_false_label = drop_through_label;
-      drop_through_if_true = false;
       drop_through_if_false = true;
       prob = inv (prob);
     }
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 0bbb90ed3aa1..235f71cbd133 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -17612,7 +17612,6 @@ loc_list_from_tree_1 (tree loc, int want_address,
 		{
 		  ret1 = new_loc_descr (DW_OP_piece, size - offset, 0);
 		  add_loc_descr (&ret, ret1);
-		  offset = size;
 		}
 
 	      have_address = !!want_address;
diff --git a/gcc/final.c b/gcc/final.c
index 820162b2d28d..031cf6091c30 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -1410,7 +1410,6 @@ shorten_branches (rtx_insn *first)
 	      rtx_sequence *seqn = as_a <rtx_sequence *> (PATTERN (insn));
 	      int i;
 
-	      body = PATTERN (insn);
 	      new_length = 0;
 	      for (i = 0; i < seqn->len (); i++)
 		{
diff --git a/gcc/gengtype.c b/gcc/gengtype.c
index a315c6cfe87a..f7735cce6339 100644
--- a/gcc/gengtype.c
+++ b/gcc/gengtype.c
@@ -345,7 +345,7 @@ read_input_list (const char *listname)
       size_t bufsz = measure_input_list (list);
       char *buf = XNEWVEC (char, bufsz);
       char *here = buf;
-      char *committed = buf;
+      char *committed;
       char *limit = buf + bufsz;
       char *line;
       bool is_language;
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index fbf136fbce4a..4be3e8a98cbe 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -12612,7 +12612,6 @@ gimplify_function_tree (tree fndecl)
       seq = NULL;
       gimple_seq_add_stmt (&seq, new_bind);
       gimple_set_body (fndecl, seq);
-      bind = new_bind;
     }
 
   if ((flag_sanitize & SANITIZE_THREAD) != 0
diff --git a/gcc/ipa-chkp.c b/gcc/ipa-chkp.c
index c7fc3a0d0be7..6604207881f3 100644
--- a/gcc/ipa-chkp.c
+++ b/gcc/ipa-chkp.c
@@ -494,8 +494,6 @@ chkp_maybe_create_clone (tree fndecl)
 	  || DECL_FUNCTION_CODE (fndecl) >= BEGIN_CHKP_BUILTINS))
     return NULL;
 
-  clone = node->instrumented_version;
-
   /* Some instrumented builtin function calls may be optimized and
      cgraph nodes may be removed as unreachable.  Later optimizations
      may generate new calls to removed functions and in this case
diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c
index 611faab570f6..80faa8b8f164 100644
--- a/gcc/ipa-inline-analysis.c
+++ b/gcc/ipa-inline-analysis.c
@@ -696,7 +696,6 @@ account_size_time (struct inline_summary *summary, int size, int time,
       }
   if (i == 256)
     {
-      i = 0;
       found = true;
       e = &(*summary->entry)[0];
       gcc_assert (!e->predicate.clause[0]);
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index b3d51595d3fa..707ad891e16c 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -2832,7 +2832,7 @@ ipa_make_edge_direct_to_target (struct cgraph_edge *ie, tree target,
 				bool speculative)
 {
   struct cgraph_node *callee;
-  struct inline_edge_summary *es = inline_edge_summary (ie);
+  struct inline_edge_summary *es;
   bool unreachable = false;
 
   if (TREE_CODE (target) == ADDR_EXPR)
diff --git a/gcc/ira-color.c b/gcc/ira-color.c
index ab981730ebae..3d5bf772cbf2 100644
--- a/gcc/ira-color.c
+++ b/gcc/ira-color.c
@@ -1106,7 +1106,6 @@ setup_profitable_hard_regs (void)
 	  || empty_profitable_hard_regs (a))
 	continue;
       data = ALLOCNO_COLOR_DATA (a);
-      mode = ALLOCNO_MODE (a);
       if ((costs = ALLOCNO_UPDATED_HARD_REG_COSTS (a)) != NULL
 	  || (costs = ALLOCNO_HARD_REG_COSTS (a)) != NULL)
 	{
@@ -3264,16 +3263,13 @@ color_pass (ira_loop_tree_node_t loop_tree_node)
 	    && (loop_tree_node->reg_pressure[pclass]
 		<= ira_class_hard_regs_num[pclass]))
 	  {
-	    mode = ALLOCNO_MODE (a);
 	    hard_regno = ALLOCNO_HARD_REGNO (a);
 	    if (hard_regno >= 0)
 	      {
 		index = ira_class_hard_reg_index[rclass][hard_regno];
 		ira_assert (index >= 0);
 	      }
-	    regno = ALLOCNO_REGNO (a);
 	    subloop_allocno = ALLOCNO_CAP_MEMBER (a);
-	    subloop_node = ALLOCNO_LOOP_TREE_NODE (subloop_allocno);
 	    ira_assert (!ALLOCNO_ASSIGNED_P (subloop_allocno));
 	    ALLOCNO_HARD_REGNO (subloop_allocno) = hard_regno;
 	    ALLOCNO_ASSIGNED_P (subloop_allocno) = true;
diff --git a/gcc/ira.c b/gcc/ira.c
index b41c480c99d5..b7a3a414b67c 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -4356,7 +4356,6 @@ rtx_moveable_p (rtx *loc, enum op_type type)
   enum rtx_code code = GET_CODE (x);
   int i, j;
 
-  code = GET_CODE (x);
   switch (code)
     {
     case CONST:
diff --git a/gcc/lra-eliminations.c b/gcc/lra-eliminations.c
index 695f99ad317c..fc5d779490ff 100644
--- a/gcc/lra-eliminations.c
+++ b/gcc/lra-eliminations.c
@@ -1138,7 +1138,6 @@ eliminate_regs_in_insn (rtx_insn *insn, bool replace_p, bool first_p,
      single_set without having put new body into the insn and the
      re-recognition won't hurt in this rare case.  */
   id = lra_update_insn_recog_data (insn);
-  static_id = id->insn_static_data;
 }
 
 /* Spill pseudos which are assigned to hard registers in SET.  Add
diff --git a/gcc/lra.c b/gcc/lra.c
index ed1f062d2ee5..618fef1b33ae 100644
--- a/gcc/lra.c
+++ b/gcc/lra.c
@@ -817,7 +817,7 @@ collect_non_operand_hard_regs (rtx *x, lra_insn_recog_data_t data,
   struct lra_insn_reg *curr;
   rtx op = *x;
   enum rtx_code code = GET_CODE (op);
-  const char *fmt = GET_RTX_FORMAT (code);
+  const char *fmt;
 
   for (i = 0; i < data->insn_static_data->n_operands; i++)
     if (x == data->operand_loc[i])
@@ -993,7 +993,7 @@ lra_set_insn_recog_data (rtx_insn *insn)
 			       constraints, operand_mode, NULL);
 	  if (nop > 0)
 	    {
-	      const char *p =  recog_data.constraints[0];
+	      const char *p;
 
 	      for (p =	constraints[0]; *p; p++)
 		nalt += *p == ',';
diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c
index 41ae7e4fb9cd..4438613ef7c9 100644
--- a/gcc/reg-stack.c
+++ b/gcc/reg-stack.c
@@ -482,7 +482,6 @@ check_asm_stack_operands (rtx_insn *insn)
 
   if (which_alternative < 0)
     {
-      malformed_asm = 1;
       /* Avoid further trouble with this insn.  */
       PATTERN (insn) = gen_rtx_USE (VOIDmode, const0_rtx);
       return 0;
diff --git a/gcc/regrename.c b/gcc/regrename.c
index 58036644fc6a..8169a3682577 100644
--- a/gcc/regrename.c
+++ b/gcc/regrename.c
@@ -888,10 +888,10 @@ regrename_analyze (bitmap bb_mask)
 	  edge_iterator ei;
 	  struct du_head *chain = regrename_chain_from_id (j);
 	  int n_succs_used = 0, n_succs_joined = 0;
+	  bool printed = false;
 
 	  FOR_EACH_EDGE (e, ei, bb->succs)
 	    {
-	      bool printed = false;
 	      struct bb_rename_info *dest_ri;
 	      unsigned k;
 	      bitmap_iterator bi2;
@@ -1424,7 +1424,6 @@ scan_rtx (rtx_insn *insn, rtx *loc, enum reg_class cl, enum scan_actions action,
   enum rtx_code code = GET_CODE (x);
   int i, j;
 
-  code = GET_CODE (x);
   switch (code)
     {
     case CONST:
diff --git a/gcc/reorg.c b/gcc/reorg.c
index 85ef7d6880cb..4d0315fe397d 100644
--- a/gcc/reorg.c
+++ b/gcc/reorg.c
@@ -2672,7 +2672,7 @@ fill_slots_from_thread (rtx_jump_insn *insn, rtx condition,
       && GET_CODE (PATTERN (new_thread)) != ASM_INPUT
       && asm_noperands (PATTERN (new_thread)) < 0)
     {
-      rtx pat = PATTERN (new_thread);
+      rtx pat;
       rtx dest;
       rtx src;
 
diff --git a/gcc/sel-sched.c b/gcc/sel-sched.c
index 708d0887e77d..52f5a2e535e5 100644
--- a/gcc/sel-sched.c
+++ b/gcc/sel-sched.c
@@ -2236,7 +2236,6 @@ moveup_expr (expr_t expr, insn_t through_insn, bool inside_insn_group,
       if (res >= 0)
 	{
           /* Speculation was successful.  */
-          full_ds = 0;
           was_changed = (res > 0);
           if (res == 2)
             was_target_conflict = true;
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index bd4b48e8623e..d6d9f30253e5 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1903,7 +1903,6 @@ copy_bb (copy_body_data *id, basic_block bb, int frequency_scale,
 		{
 		  /* Append the rest of arguments removing bounds.  */
 		  unsigned cur = gimple_call_num_args (call_stmt);
-		  i = gimple_call_num_args (id->call_stmt) - nargs;
 		  for (i = gimple_call_num_args (id->call_stmt) - nargs;
 		       i < gimple_call_num_args (id->call_stmt);
 		       i++)
@@ -6060,7 +6059,6 @@ tree_function_versioning (tree old_decl, tree new_decl,
 	  gimple_stmt_iterator cgsi
 	    = gsi_after_labels (single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun)));
 	  gimple *def_temp;
-	  var = vars;
 	  i = vec_safe_length (*debug_args);
 	  do
 	    {
diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c
index 739301140f0a..a92cfee0efee 100644
--- a/gcc/tree-parloops.c
+++ b/gcc/tree-parloops.c
@@ -2858,7 +2858,7 @@ ref_conflicts_with_region (gimple_stmt_iterator gsi, ao_ref *ref,
 			   bool ref_is_store, vec<basic_block> region_bbs,
 			   unsigned int i, gimple *skip_stmt)
 {
-  basic_block bb = region_bbs[i];
+  basic_block bb;
   gsi_next (&gsi);
 
   while (true)
diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c
index 0c3b0d2a4071..a4a8c4ba5c99 100644
--- a/gcc/tree-ssa-loop-ivcanon.c
+++ b/gcc/tree-ssa-loop-ivcanon.c
@@ -1361,7 +1361,6 @@ tree_unroll_loops_completely (bool may_increase_size, bool unroll_outer)
 
   do
     {
-      changed = false;
       bitmap loop_closed_ssa_invalidated = NULL;
 
       if (loops_state_satisfies_p (LOOP_CLOSED_SSA))
diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c
index de206471edb2..92d5351e0765 100644
--- a/gcc/tree-ssa-loop-niter.c
+++ b/gcc/tree-ssa-loop-niter.c
@@ -1142,7 +1142,7 @@ number_of_iterations_lt_to_ne (tree type, affine_iv *iv0, affine_iv *iv1,
   tree niter_type = TREE_TYPE (step);
   tree mod = fold_build2 (FLOOR_MOD_EXPR, niter_type, *delta, step);
   tree tmod;
-  tree assumption = boolean_true_node, bound;
+  tree assumption, bound;
   tree type1 = (POINTER_TYPE_P (type)) ? sizetype : type;
 
   if (TREE_CODE (mod) != INTEGER_CST)
diff --git a/gcc/tree-ssa-phionlycprop.c b/gcc/tree-ssa-phionlycprop.c
index f61b269cd63d..ae52d5fcb522 100644
--- a/gcc/tree-ssa-phionlycprop.c
+++ b/gcc/tree-ssa-phionlycprop.c
@@ -519,7 +519,6 @@ pass_phi_only_cprop::execute (function *fun)
   interesting_names1 = BITMAP_ALLOC (NULL);
 
   calculate_dominance_info (CDI_DOMINATORS);
-  cfg_altered = false;
 
   /* First phase.  Eliminate degenerate PHIs via a dominator
      walk of the CFG.
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index c043e5ec3a6b..57a77c4ae96d 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -2766,7 +2766,6 @@ solve_graph (constraint_graph_t graph)
 
 		      unsigned int to = find (j);
 		      tmp = get_varinfo (to)->solution;
-		      flag = false;
 
 		      /* Don't try to propagate to ourselves.  */
 		      if (to == i)
diff --git a/gcc/tree-ssa-threadedge.c b/gcc/tree-ssa-threadedge.c
index 4949bfa03ab9..040d44065eb3 100644
--- a/gcc/tree-ssa-threadedge.c
+++ b/gcc/tree-ssa-threadedge.c
@@ -1277,7 +1277,6 @@ thread_across_edge (gcond *dummy_cond,
 
         x = new jump_thread_edge (taken_edge, EDGE_COPY_SRC_JOINER_BLOCK);
 	path->safe_push (x);
-	found = false;
 	found = thread_around_empty_blocks (taken_edge,
 					    dummy_cond,
 					    avail_exprs_stack,
diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c
index 2f82061afa97..a0ba8168c169 100644
--- a/gcc/tree-vect-loop-manip.c
+++ b/gcc/tree-vect-loop-manip.c
@@ -1651,7 +1651,7 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1,
   basic_block guard_bb, guard_to;
   int prob_prolog, prob_vector, prob_epilog;
   int bound_prolog = 0, bound_scalar = 0, bound = 0;
-  int vf = LOOP_VINFO_VECT_FACTOR (loop_vinfo);
+  int vf;
   int prolog_peeling = LOOP_VINFO_PEELING_FOR_ALIGNMENT (loop_vinfo);
   bool epilog_peeling = (LOOP_VINFO_PEELING_FOR_NITER (loop_vinfo)
 			 || LOOP_VINFO_PEELING_FOR_GAPS (loop_vinfo));
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 6bbf8162a863..f604ee75ba46 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -3829,7 +3829,7 @@ get_initial_def_for_induction (gimple *iv_phi)
   struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
   tree vectype;
   int nunits;
-  edge pe = loop_preheader_edge (loop);
+  edge pe;
   struct loop *iv_loop;
   basic_block new_bb;
   tree new_vec, vec_init, vec_step, t;
@@ -4419,7 +4419,7 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, gimple *stmt,
   tree vec_dest;
   tree new_temp = NULL_TREE, new_dest, new_name, new_scalar_dest;
   gimple *epilog_stmt = NULL;
-  enum tree_code code = gimple_assign_rhs_code (stmt);
+  enum tree_code code;
   gimple *exit_phi;
   tree bitsize;
   tree adjustment_def = NULL;
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index e254aa0e49f2..bff9d61a38f3 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -1793,7 +1793,7 @@ vect_analyze_slp_instance (vec_info *vinfo,
 {
   slp_instance new_instance;
   slp_tree node;
-  unsigned int group_size = GROUP_SIZE (vinfo_for_stmt (stmt));
+  unsigned int group_size;
   unsigned int unrolling_factor = 1, nunits;
   tree vectype, scalar_type = NULL_TREE;
   gimple *next;
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 11a8ac4bc8c0..614df4052458 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -5029,8 +5029,6 @@ output_constructor_regular_field (oc_local_state *local)
   /* Determine size this element should occupy.  */
   if (local->field)
     {
-      fieldsize = 0;
-
       /* If this is an array with an unspecified upper bound,
 	 the initializer determines the size.  */
       /* ??? This ought to only checked if DECL_SIZE_UNIT is NULL,
-- 
Markus



More information about the Gcc-patches mailing list