toolchain: Update GCC 8 to version 8.4.0
[oweals/openwrt.git] / toolchain / gcc / patches / 9.2.0 / 100-Fix_uninitialised_use_in_mips_split_move.patch
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
5
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
10 valid memory.
11
12 2019-07-07  Richard Sandiford  <richard.sandiford@arm.com>
13
14 gcc/
15         * config/mips/mips.c (mips_split_move): Zero-initialize addr
16         and check whether addr.reg is nonnull before using it.
17
18
19 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@273174 138bc75d-0d04-0410-961f-82ee72b054a4
20 ---
21  gcc/ChangeLog          | 5 +++++
22  gcc/config/mips/mips.c | 4 ++--
23  2 files changed, 7 insertions(+), 2 deletions(-)
24
25 --- a/gcc/ChangeLog
26 +++ b/gcc/ChangeLog
27 @@ -1,3 +1,8 @@
28 +2019-07-07  Richard Sandiford  <richard.sandiford@arm.com>
29 +
30 +       * config/mips/mips.c (mips_split_move): Zero-initialize addr
31 +       and check whether addr.reg is nonnull before using it.
32 +
33  2019-08-12  Release Manager
34  
35         * GCC 9.2.0 released.
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
40       simple store.   */
41    rtx_insn *insn = (rtx_insn *)insn_;
42 -  struct mips_address_info addr;
43 +  struct mips_address_info addr = {};
44    if (insn)
45      {
46        rtx_insn *next = next_nonnote_nondebug_insn_bb (insn);
47 @@ -4862,7 +4862,7 @@ mips_split_move (rtx dest, rtx src, enum
48                 {
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);
54                 }
55               else