From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16238 invoked by alias); 1 Aug 2007 08:54:17 -0000 Received: (qmail 16198 invoked by uid 22791); 1 Aug 2007 08:54:16 -0000 X-Spam-Check-By: sourceware.org Received: from mtagate2.de.ibm.com (HELO mtagate2.de.ibm.com) (195.212.29.151) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 01 Aug 2007 08:54:14 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate2.de.ibm.com (8.13.8/8.13.8) with ESMTP id l718sB1O113764 for ; Wed, 1 Aug 2007 08:54:11 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v8.4) with ESMTP id l718sB1A1597688 for ; Wed, 1 Aug 2007 10:54:11 +0200 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id l718s5eg014240 for ; Wed, 1 Aug 2007 10:54:05 +0200 Received: from blc4eb430604175.ibm.com (dyn-9-152-216-52.boeblingen.de.ibm.com [9.152.216.52]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with SMTP id l718s58K014176 for ; Wed, 1 Aug 2007 10:54:05 +0200 Received: by blc4eb430604175.ibm.com (sSMTP sendmail emulation); Wed, 1 Aug 2007 10:53:15 +0200 Date: Wed, 01 Aug 2007 08:54:00 -0000 From: Andreas Krebbel To: gcc-patches@gcc.gnu.org Subject: [Committed 4.1 4.2] S/390: Wrong mode passed to operand_subword Message-ID: <20070801085315.GA3825@blc4eb430604175.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2007-08/txt/msg00015.txt.bz2 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 * config/s390/s390.md (TF in GPR splitter): Change operand_subword parameter to TFmode. 2007-08-01 Andreas Krebbel * 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); + } + } + }