re PR target/18701 (mmix-knuth-mmixware gcc.c-torture/execute failures: 20010224...
authorHans-Peter Nilsson <hp@bitrange.com>
Fri, 31 Dec 2004 16:28:34 +0000 (16:28 +0000)
committerHans-Peter Nilsson <hp@gcc.gnu.org>
Fri, 31 Dec 2004 16:28:34 +0000 (16:28 +0000)
PR target/18701
* combine.c (combine_simplify_rtx): Do not allow paradoxical
subregs of MEM.

From-SVN: r92762

gcc/ChangeLog
gcc/combine.c

index 81d0b997c41400fa37a445bbbca48717fd66899a..86b58686fc95a41cbad576314da073d6964b67bc 100644 (file)
@@ -1,5 +1,9 @@
 2004-12-31  Hans-Peter Nilsson  <hp@bitrange.com>
 
+       PR target/18701
+       * combine.c (combine_simplify_rtx): Do not allow paradoxical
+       subregs of MEM.
+
        PR target/18701
        * combine.c (gen_lowpart_for_combine): When stripping SUBREG of
        MEM, adjust imode and isize.
index 61b93dd30489d2c7b34350e3bd607cb896d1b0bc..90934e116729cad8915e48f1657e02b575808826 100644 (file)
@@ -3983,10 +3983,14 @@ combine_simplify_rtx (rtx x, enum machine_mode op0_mode, int in_dest)
       }
 
       /* Don't change the mode of the MEM if that would change the meaning
-        of the address.  */
+        of the address.  Similarly, don't allow widening, as that may
+        access memory outside the defined object or using an address
+        that is invalid for a wider mode.  */
       if (MEM_P (SUBREG_REG (x))
          && (MEM_VOLATILE_P (SUBREG_REG (x))
-             || mode_dependent_address_p (XEXP (SUBREG_REG (x), 0))))
+             || mode_dependent_address_p (XEXP (SUBREG_REG (x), 0))
+             || (GET_MODE_SIZE (mode)
+                 > GET_MODE_SIZE (GET_MODE (SUBREG_REG (x))))))
        return gen_rtx_CLOBBER (mode, const0_rtx);
 
       /* Note that we cannot do any narrowing for non-constants since