summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/reload.c10
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/pr27661.c25
4 files changed, 46 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a27b0450685..35c5e7a473a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/reload.c b/gcc/reload.c
index 03b5ba6beef..feaec60433c 100644
--- a/gcc/reload.c
+++ b/gcc/reload.c
@@ -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]));
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index bcc0bafeece..e45fa3bc5b0 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 00000000000..7660c822fb9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr27661.c
@@ -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");
+}
+