]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Backprot fix for uninitialised use in mips_split_move
authorDragan Mladjenovic <draganm@gcc.gnu.org>
Fri, 4 Oct 2019 10:57:48 +0000 (10:57 +0000)
committerDragan Mladjenovic <draganm@gcc.gnu.org>
Fri, 4 Oct 2019 10:57:48 +0000 (10:57 +0000)
Fixes PR target/91474 and PR target/91702.

2019-10-04  Dragan Mladjenovic  <dmladjenovic@wavecomp.com>

Backport from mainline
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: r276569

gcc/ChangeLog
gcc/config/mips/mips.c

index 1e9c050d45a08a8ce5176ebb9197729016d8e3d9..ac7ae9ff1e300d5ef276cda9e92bb65804dd2103 100644 (file)
@@ -1,3 +1,11 @@
+       2019-10-04  Dragan Mladjenovic <dmladjenovic@wavecomp.com>
+
+       Backport from mainline
+       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-10-02  Bernd Edlinger  <bernd.edlinger@hotmail.de>
 
        Backport from mainline
index 2dfc7c73cce6de51f78a31f00d22badf197ed52d..53429270327c24aa8824423ed899bf006cc5c537 100644 (file)
@@ -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
      simple store.   */
   rtx_insn *insn = (rtx_insn *)insn_;
-  struct mips_address_info addr;
+  struct mips_address_info addr = {};
   if (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_)
                {
                  rtx tmp = XEXP (src, 0);
                  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);
                }
              else