OSDN Git Service

PR rtl-optimization/27661
authoruweigand <uweigand@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 26 May 2006 20:21:53 +0000 (20:21 +0000)
committeruweigand <uweigand@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 26 May 2006 20:21:53 +0000 (20:21 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@114141 138bc75d-0d04-0410-961f-82ee72b054a4

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

index a27b045..35c5e7a 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 03b5ba6..feaec60 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 bcc0baf..e45fa3b 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");
+}
+