public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
To: gcc-patches@gcc.gnu.org
Subject: [Committed 4.1 4.2] S/390: Wrong mode passed to operand_subword
Date: Wed, 01 Aug 2007 08:54:00 -0000	[thread overview]
Message-ID: <20070801085315.GA3825@blc4eb430604175.ibm.com> (raw)

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);
+       }
+     }
+ }

                 reply	other threads:[~2007-08-01  8:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070801085315.GA3825@blc4eb430604175.ibm.com \
    --to=andreas.krebbel@de.ibm.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).