1 From d57faea9337ad595d005687247c3322252f70ba1 Mon Sep 17 00:00:00 2001
2 From: rsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
3 Date: Sun, 7 Jul 2019 09:49:14 +0000
4 Subject: [PATCH] Fix uninitialised use in mips_split_move
6 While testing the fix for PR91068, I hit an rtl checking failure
7 while building newlib. mips_split_move was decomposing an address that
8 happened to be symbolic and then tried to access the REGNO of the base
9 register field, which wasn't initialised but which by chance pointed to
12 2019-07-07 Richard Sandiford <richard.sandiford@arm.com>
15 * config/mips/mips.c (mips_split_move): Zero-initialize addr
16 and check whether addr.reg is nonnull before using it.
19 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@273174 138bc75d-0d04-0410-961f-82ee72b054a4
21 gcc/ChangeLog | 5 +++++
22 gcc/config/mips/mips.c | 4 ++--
23 2 files changed, 7 insertions(+), 2 deletions(-)
28 +2019-07-07 Richard Sandiford <richard.sandiford@arm.com>
30 + * config/mips/mips.c (mips_split_move): Zero-initialize addr
31 + and check whether addr.reg is nonnull before using it.
33 2019-08-12 Release Manager
36 --- a/gcc/config/mips/mips.c
37 +++ b/gcc/config/mips/mips.c
38 @@ -4849,7 +4849,7 @@ mips_split_move (rtx dest, rtx src, enum
39 can forward SRC for DEST. This is most useful if the next insn is a
41 rtx_insn *insn = (rtx_insn *)insn_;
42 - struct mips_address_info addr;
43 + struct mips_address_info addr = {};
46 rtx_insn *next = next_nonnote_nondebug_insn_bb (insn);
47 @@ -4862,7 +4862,7 @@ mips_split_move (rtx dest, rtx src, enum
49 rtx tmp = XEXP (src, 0);
50 mips_classify_address (&addr, tmp, GET_MODE (tmp), true);
51 - if (REGNO (addr.reg) != REGNO (dest))
52 + if (addr.reg && REGNO (addr.reg) != REGNO (dest))
53 validate_change (next, &SET_SRC (set), src, false);