This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Committed 4.1 4.2] S/390: Wrong mode passed to operand_subword
- From: Andreas Krebbel <Andreas dot Krebbel at de dot ibm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 1 Aug 2007 10:53:15 +0200
- Subject: [Committed 4.1 4.2] S/390: Wrong mode passed to operand_subword
Hi,
I've applied the attached patch to GCC 4.1 and 4.2 branch. The problem has
already been fixed on mainline while merging several patterns using mode
macros.
The attached testcase only fails on GCC 4.2. I wasn't able to adjust it to
fail on 4.1 as well.
Bootstrapped on s390x with GCC 4.2.
Bye,
-Andreas-
2007-08-01 Andreas Krebbel <krebbel1@de.ibm.com>
* config/s390/s390.md (TF in GPR splitter): Change operand_subword
parameter to TFmode.
2007-08-01 Andreas Krebbel <krebbel1@de.ibm.com>
* gcc.dg/20070801-1.c: New testcase.
Index: gcc/config/s390/s390.md
===================================================================
*** gcc/config/s390/s390.md.orig 2007-08-01 09:59:53.000000000 +0200
--- gcc/config/s390/s390.md 2007-08-01 10:28:28.000000000 +0200
***************
*** 1500,1506 ****
&& !s_operand (operands[1], VOIDmode)"
[(set (match_dup 0) (match_dup 1))]
{
! rtx addr = operand_subword (operands[0], 1, 0, DFmode);
s390_load_address (addr, XEXP (operands[1], 0));
operands[1] = replace_equiv_address (operands[1], addr);
})
--- 1500,1506 ----
&& !s_operand (operands[1], VOIDmode)"
[(set (match_dup 0) (match_dup 1))]
{
! rtx addr = operand_subword (operands[0], 1, 0, TFmode);
s390_load_address (addr, XEXP (operands[1], 0));
operands[1] = replace_equiv_address (operands[1], addr);
})
Index: gcc/testsuite/gcc.dg/20070801-1.c
===================================================================
*** /dev/null 1970-01-01 00:00:00.000000000 +0000
--- gcc/testsuite/gcc.dg/20070801-1.c 2007-08-01 10:33:49.000000000 +0200
***************
*** 0 ****
--- 1,62 ----
+ /* This failed on s390x due to a back end bug. */
+
+ /* { dg-do compile { target fpic } } */
+ /* { dg-options "-O2 -fpic" } */
+
+ typedef long unsigned int size_t;
+ typedef enum
+ {
+ TYPE_SCHAR, TYPE_LONGDOUBLE
+ }
+ arg_type;
+
+ typedef struct
+ {
+ arg_type type;
+ union
+ {
+ signed char a_schar;
+ long double a_longdouble;
+ }
+ a;
+ }
+ argument;
+
+ typedef struct
+ {
+ argument *arg;
+ }
+ arguments;
+
+ int ind;
+
+ extern void foo (arguments *a);
+
+ void
+ bar ()
+ {
+ arguments a;
+ char *buf;
+ char *result;
+ int uninitialized;
+ int count, i;
+ int retcount;
+
+ foo (&a);
+
+ switch (a.arg[ind].type)
+ {
+ case TYPE_SCHAR:
+ {
+ if (uninitialized == 0)
+ __builtin___snprintf_chk (result, 10, 1, 10, buf, 1, &count);
+ }
+ case TYPE_LONGDOUBLE:
+ {
+ long double arg = a.arg[ind].a.a_longdouble;
+
+ if (uninitialized == 0)
+ __builtin___snprintf_chk (result, 10, 1, 10, buf, arg, &count);
+ }
+ }
+ }