re PR rtl-optimization/27661 (ICE in subst_reloads)
authorUlrich Weigand <uweigand@de.ibm.com>
Fri, 26 May 2006 20:21:53 +0000 (20:21 +0000)
committerUlrich Weigand <uweigand@gcc.gnu.org>
Fri, 26 May 2006 20:21:53 +0000 (20:21 +0000)
PR rtl-optimization/27661
* reload.c (find_reloads): When reloading a VOIDmode constant
as address due to an EXTRA_MEMORY_CONSTRAINT or 'o' constraint,
use Pmode as mode of the reload register.

PR rtl-optimization/27661
* gcc.dg/pr27661.c: New test case.

From-SVN: r114141

gcc/ChangeLog
gcc/reload.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr27661.c [new file with mode: 0644]

index a27b04506852c39a0083c18706e9a38dae0e2243..35c5e7a473a01f9ad4350e18531d79e0c8ddf5d1 100644 (file)
@@ -1,3 +1,10 @@
+2006-05-26  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       PR rtl-optimization/27661
+       * reload.c (find_reloads): When reloading a VOIDmode constant
+       as address due to an EXTRA_MEMORY_CONSTRAINT or 'o' constraint,
+       use Pmode as mode of the reload register.
+
 2006-05-26  Eric Botcazou  <ebotcazou@adacore.com>
 
        * doc/invoke.texi (Optimize Options): Document that -funit-at-a-time
index 03b5ba6beef4a068e214b579798f9423ecadc3ff..feaec60433cb0bb7574c00a1fd5ba9073db9bb54 100644 (file)
@@ -3854,11 +3854,19 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known,
                 && goal_alternative_offmemok[i]
                 && MEM_P (recog_data.operand[i]))
          {
+           /* If the address to be reloaded is a VOIDmode constant,
+              use Pmode as mode of the reload register, as would have
+              been done by find_reloads_address.  */
+           enum machine_mode address_mode;
+           address_mode = GET_MODE (XEXP (recog_data.operand[i], 0));
+           if (address_mode == VOIDmode)
+             address_mode = Pmode;
+
            operand_reloadnum[i]
              = push_reload (XEXP (recog_data.operand[i], 0), NULL_RTX,
                             &XEXP (recog_data.operand[i], 0), (rtx*) 0,
                             base_reg_class (VOIDmode, MEM, SCRATCH),
-                            GET_MODE (XEXP (recog_data.operand[i], 0)),
+                            address_mode,
                             VOIDmode, 0, 0, i, RELOAD_FOR_INPUT);
            rld[operand_reloadnum[i]].inc
              = GET_MODE_SIZE (GET_MODE (recog_data.operand[i]));
index bcc0bafeecee71af37beba3818f1e85083d0e688..e45fa3bc5b0df442e33b17938596e6a283a39635 100644 (file)
@@ -1,3 +1,8 @@
+2006-05-26  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       PR rtl-optimization/27661
+       * gcc.dg/pr27661.c: New test case.
+
 2006-05-26  Thomas Koenig  <Thomas.Koenig@online.de>
 
        PR fortran/23151
diff --git a/gcc/testsuite/gcc.dg/pr27661.c b/gcc/testsuite/gcc.dg/pr27661.c
new file mode 100644 (file)
index 0000000..7660c82
--- /dev/null
@@ -0,0 +1,25 @@
+/* This used to ICE on s390 due to a reload bug.  */
+
+/* { dg-do compile { target s390*-*-* } } */
+/* { dg-options "-O2 -march=z990 -ftracer" } */
+
+extern int memcmp (const void *s1, const void *s2, unsigned long n);
+extern int printf (__const char *__restrict __format, ...);
+
+struct test
+{
+  char tmp[4096];
+  char msgtype[2];
+};
+
+void test (struct test *testtb)
+{
+  if (testtb)
+    printf ("a");
+
+  if (memcmp(testtb->msgtype, "a", 2))
+    printf ("a");
+
+  printf ("b");
+}
+