summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2010-03-27 17:01:34 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2010-03-27 17:01:34 +0000
commitc704d6cd2517ce3f2b39a3e5337ddfc4ced9aa1c (patch)
tree0b6311d00100fc8853fae077496ed4fc53e2b883 /gnu
parent9007ea17a49958418a25abf989c20fd25e39ff55 (diff)
Prevent uninitialized use of prev in replace_return_reg() and use
prev_nonnote_insn() in push_frame_in_operand; ok miod@
Diffstat (limited to 'gnu')
-rw-r--r--gnu/egcs/gcc/protector.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/gnu/egcs/gcc/protector.c b/gnu/egcs/gcc/protector.c
index 67285f3624f..7e651ac43ae 100644
--- a/gnu/egcs/gcc/protector.c
+++ b/gnu/egcs/gcc/protector.c
@@ -1647,16 +1647,13 @@ replace_return_reg (first, return_save)
rtx first, return_save;
{
rtx return_reg = DECL_RTL (DECL_RESULT (current_function_decl));
- rtx insn;
+ rtx insn, prev;
/* comfirm that insn patterns are the expected order */
- for (insn = first; insn; insn = NEXT_INSN (insn))
+ for (prev = NULL, insn = first; insn; insn = NEXT_INSN (insn))
{
if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
{
-
- rtx prev;
-
if (PREV_INSN (insn)) prev = PREV_INSN (insn);
if (GET_CODE (PATTERN (insn)) == USE && XEXP (PATTERN (insn), 0) == return_reg)
@@ -1666,12 +1663,10 @@ replace_return_reg (first, return_save)
}
/* replace return register */
- for (insn = first; insn; insn = NEXT_INSN (insn))
+ for (prev = NULL, insn = first; insn; insn = NEXT_INSN (insn))
{
if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
{
- rtx prev;
-
if (PREV_INSN (insn)) prev = PREV_INSN (insn);
if (GET_CODE (PATTERN (insn)) == USE
&& XEXP (PATTERN (insn), 0) == return_reg
@@ -2241,7 +2236,7 @@ push_frame_in_operand (insn, orig, push_size, boundary)
rtx insn, orig;
HOST_WIDE_INT push_size, boundary;
{
- register rtx x = orig;
+ register rtx x = orig, prev_insn;
register enum rtx_code code;
int i, j;
HOST_WIDE_INT offset;
@@ -2333,6 +2328,7 @@ push_frame_in_operand (insn, orig, push_size, boundary)
case PLUS:
offset = AUTO_OFFSET(x);
+ prev_insn = prev_nonnote_insn (insn);
/* Handle special case of frame register plus constant. */
if (CONSTANT_P (XEXP (x, 1))
@@ -2387,17 +2383,17 @@ push_frame_in_operand (insn, orig, push_size, boundary)
*/
else if (XEXP (x, 0) == frame_pointer_rtx
&& GET_CODE (XEXP (x, 1)) == REG
- && PREV_INSN (insn)
- && PATTERN (PREV_INSN (insn))
- && SET_DEST (PATTERN (PREV_INSN (insn))) == XEXP (x, 1)
- && CONSTANT_P (SET_SRC (PATTERN (PREV_INSN (insn)))))
+ && prev_insn
+ && PATTERN (prev_insn)
+ && SET_DEST (PATTERN (prev_insn)) == XEXP (x, 1)
+ && CONSTANT_P (SET_SRC (PATTERN (prev_insn))))
{
- HOST_WIDE_INT offset = INTVAL (SET_SRC (PATTERN (PREV_INSN (insn))));
+ HOST_WIDE_INT offset = INTVAL (SET_SRC (PATTERN (prev_insn)));
if (x->used || offset < boundary)
return;
- SET_SRC (PATTERN (PREV_INSN (insn)))
+ SET_SRC (PATTERN (prev_insn))
= gen_rtx_CONST_INT (VOIDmode, offset + push_size);
x->used = 1;
XEXP (x, 1)->used = 1;