Commit 41defab3 by Richard Sandiford Committed by Richard Sandiford

PR81285: Fix uninitialised variable in emit_store_flag_int

2017-09-12  Richard Sandiford  <richard.sandiford@linaro.org>

gcc/
	PR rtl-optimization/82185
	* expmed.c (emit_store_flag_int): Only test tem if it has been
	initialized.

From-SVN: r252008
parent c651dca2
2017-09-12 Richard Sandiford <richard.sandiford@linaro.org>
PR rtl-optimization/82185
* expmed.c (emit_store_flag_int): Only test tem if it has been
initialized.
2017-09-12 Richard Biener <rguenther@suse.de> 2017-09-12 Richard Biener <rguenther@suse.de>
PR middle-end/82149 PR middle-end/82149
......
...@@ -5601,7 +5601,6 @@ emit_store_flag_int (rtx target, rtx subtarget, enum rtx_code code, rtx op0, ...@@ -5601,7 +5601,6 @@ emit_store_flag_int (rtx target, rtx subtarget, enum rtx_code code, rtx op0,
{ {
machine_mode target_mode = target ? GET_MODE (target) : VOIDmode; machine_mode target_mode = target ? GET_MODE (target) : VOIDmode;
rtx_insn *last = get_last_insn (); rtx_insn *last = get_last_insn ();
rtx tem;
/* If this is an equality comparison of integers, we can try to exclusive-or /* If this is an equality comparison of integers, we can try to exclusive-or
(or subtract) the two operands and use a recursive call to try the (or subtract) the two operands and use a recursive call to try the
...@@ -5610,8 +5609,8 @@ emit_store_flag_int (rtx target, rtx subtarget, enum rtx_code code, rtx op0, ...@@ -5610,8 +5609,8 @@ emit_store_flag_int (rtx target, rtx subtarget, enum rtx_code code, rtx op0,
if ((code == EQ || code == NE) && op1 != const0_rtx) if ((code == EQ || code == NE) && op1 != const0_rtx)
{ {
tem = expand_binop (mode, xor_optab, op0, op1, subtarget, 1, rtx tem = expand_binop (mode, xor_optab, op0, op1, subtarget, 1,
OPTAB_WIDEN); OPTAB_WIDEN);
if (tem == 0) if (tem == 0)
tem = expand_binop (mode, sub_optab, op0, op1, subtarget, 1, tem = expand_binop (mode, sub_optab, op0, op1, subtarget, 1,
...@@ -5643,26 +5642,28 @@ emit_store_flag_int (rtx target, rtx subtarget, enum rtx_code code, rtx op0, ...@@ -5643,26 +5642,28 @@ emit_store_flag_int (rtx target, rtx subtarget, enum rtx_code code, rtx op0,
&& rtx_cost (GEN_INT (normalizep), mode, PLUS, 1, && rtx_cost (GEN_INT (normalizep), mode, PLUS, 1,
optimize_insn_for_speed_p ()) == 0) optimize_insn_for_speed_p ()) == 0)
{ {
tem = emit_store_flag_1 (subtarget, rcode, op0, op1, mode, 0, rtx tem = emit_store_flag_1 (subtarget, rcode, op0, op1, mode, 0,
STORE_FLAG_VALUE, target_mode); STORE_FLAG_VALUE, target_mode);
if (tem != 0) if (tem != 0)
tem = expand_binop (target_mode, add_optab, tem, tem = expand_binop (target_mode, add_optab, tem,
gen_int_mode (normalizep, target_mode), gen_int_mode (normalizep, target_mode),
target, 0, OPTAB_WIDEN); target, 0, OPTAB_WIDEN);
if (tem != 0)
return tem;
} }
else if (!want_add else if (!want_add
&& rtx_cost (trueval, mode, XOR, 1, && rtx_cost (trueval, mode, XOR, 1,
optimize_insn_for_speed_p ()) == 0) optimize_insn_for_speed_p ()) == 0)
{ {
tem = emit_store_flag_1 (subtarget, rcode, op0, op1, mode, 0, rtx tem = emit_store_flag_1 (subtarget, rcode, op0, op1, mode, 0,
normalizep, target_mode); normalizep, target_mode);
if (tem != 0) if (tem != 0)
tem = expand_binop (target_mode, xor_optab, tem, trueval, target, tem = expand_binop (target_mode, xor_optab, tem, trueval, target,
INTVAL (trueval) >= 0, OPTAB_WIDEN); INTVAL (trueval) >= 0, OPTAB_WIDEN);
if (tem != 0)
return tem;
} }
if (tem != 0)
return tem;
delete_insns_since (last); delete_insns_since (last);
} }
...@@ -5680,7 +5681,7 @@ emit_store_flag_int (rtx target, rtx subtarget, enum rtx_code code, rtx op0, ...@@ -5680,7 +5681,7 @@ emit_store_flag_int (rtx target, rtx subtarget, enum rtx_code code, rtx op0,
/* Try to put the result of the comparison in the sign bit. Assume we can't /* Try to put the result of the comparison in the sign bit. Assume we can't
do the necessary operation below. */ do the necessary operation below. */
tem = 0; rtx tem = 0;
/* To see if A <= 0, compute (A | (A - 1)). A <= 0 iff that result has /* To see if A <= 0, compute (A | (A - 1)). A <= 0 iff that result has
the sign bit set. */ the sign bit set. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment