Commit f40ce450 by Richard Sandiford Committed by Richard Sandiford

Fix uninitialised use in mips_split_move

While testing the fix for PR91068, I hit an rtl checking failure
while building newlib.  mips_split_move was decomposing an address that
happened to be symbolic and then tried to access the REGNO of the base
register field, which wasn't initialised but which by chance pointed to
valid memory.

2019-07-07  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* config/mips/mips.c (mips_split_move): Zero-initialize addr
	and check whether addr.reg is nonnull before using it.

From-SVN: r273174
parent 389aba0d
2019-07-07 Richard Sandiford <richard.sandiford@arm.com>
* config/mips/mips.c (mips_split_move): Zero-initialize addr
and check whether addr.reg is nonnull before using it.
2019-07-06 Jakub Jelinek <jakub@redhat.com> 2019-07-06 Jakub Jelinek <jakub@redhat.com>
* omp-low.c (lower_rec_input_clauses): For lastprivate clauses in * omp-low.c (lower_rec_input_clauses): For lastprivate clauses in
......
...@@ -4849,7 +4849,7 @@ mips_split_move (rtx dest, rtx src, enum mips_split_type split_type, rtx insn_) ...@@ -4849,7 +4849,7 @@ mips_split_move (rtx dest, rtx src, enum mips_split_type split_type, rtx insn_)
can forward SRC for DEST. This is most useful if the next insn is a can forward SRC for DEST. This is most useful if the next insn is a
simple store. */ simple store. */
rtx_insn *insn = (rtx_insn *)insn_; rtx_insn *insn = (rtx_insn *)insn_;
struct mips_address_info addr; struct mips_address_info addr = {};
if (insn) if (insn)
{ {
rtx_insn *next = next_nonnote_nondebug_insn_bb (insn); rtx_insn *next = next_nonnote_nondebug_insn_bb (insn);
...@@ -4862,7 +4862,7 @@ mips_split_move (rtx dest, rtx src, enum mips_split_type split_type, rtx insn_) ...@@ -4862,7 +4862,7 @@ mips_split_move (rtx dest, rtx src, enum mips_split_type split_type, rtx insn_)
{ {
rtx tmp = XEXP (src, 0); rtx tmp = XEXP (src, 0);
mips_classify_address (&addr, tmp, GET_MODE (tmp), true); mips_classify_address (&addr, tmp, GET_MODE (tmp), true);
if (REGNO (addr.reg) != REGNO (dest)) if (addr.reg && REGNO (addr.reg) != REGNO (dest))
validate_change (next, &SET_SRC (set), src, false); validate_change (next, &SET_SRC (set), src, false);
} }
else else
......
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