From patchwork Wed Jan 15 09:34:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Krebbel X-Patchwork-Id: 311040 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id BD5C02C0079 for ; Wed, 15 Jan 2014 20:35:08 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=Ec3tMHt6xBhwr5/h33vfOweNfutxV5L0tJ3LfI4x2JjhsvQXdGMTV xPqyziiT+geR0Lnm6Dqu96qFRkdxlnH0q1M9evuh9VkWQM9A/cozvoQYPQOvUG/1 cKuyPt9/IPxIdSevGcgxbgJJjTNzP8zBy5xtyUyLT65bR0XMIV0xMI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=GhpflMap4Mn5pSzKrHp6Bq+ZHCg=; b=YEb7DiXV+oFFhVWaAsOC GMCe5fAHWkwBP8c8N4lye8fvCDpSEd8hpbnT/L7wzEN2vTAWiz/vsUd4ZMuGl2wv Ea4gHPgwX1keSiHr7LuWzH1KGTTolgXVHBeGabTo69VcgAh3gh53IdKVMSnIRbyb PYXYqLb9ir+FzG3FD47ObC4= Received: (qmail 14862 invoked by alias); 15 Jan 2014 09:35:00 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 14853 invoked by uid 89); 15 Jan 2014 09:35:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: e06smtp13.uk.ibm.com Received: from e06smtp13.uk.ibm.com (HELO e06smtp13.uk.ibm.com) (195.75.94.109) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 15 Jan 2014 09:34:59 +0000 Received: from /spool/local by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 15 Jan 2014 09:34:55 -0000 Received: from d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 15 Jan 2014 09:34:53 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 2E1DF219005C for ; Wed, 15 Jan 2014 09:34:51 +0000 (GMT) Received: from d06av09.portsmouth.uk.ibm.com (d06av09.portsmouth.uk.ibm.com [9.149.37.250]) by b06cxnps4075.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s0F9YelJ53608518 for ; Wed, 15 Jan 2014 09:34:40 GMT Received: from d06av09.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av09.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s0F9Yqle028847 for ; Wed, 15 Jan 2014 02:34:52 -0700 Received: from bart (dyn-9-152-212-89.boeblingen.de.ibm.com [9.152.212.89]) by d06av09.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with SMTP id s0F9YpUK028789 for ; Wed, 15 Jan 2014 02:34:51 -0700 Received: by bart (sSMTP sendmail emulation); Wed, 15 Jan 2014 10:34:53 +0100 Date: Wed, 15 Jan 2014 10:34:53 +0100 From: Andreas Krebbel To: gcc-patches@gcc.gnu.org Subject: [Committed] S/390: Fix BZ 59803. Message-ID: <20140115093453.GA16500@bart> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14011509-2966-0000-0000-000009EFFE31 X-IsSubscribed: yes Hi, fix for BZ59803. For more details please see the comment in the patch. Bootstrapped and regtested on s390x with 4.8 and mainline. Committed to 4.8 and mainline. Bye, -Andreas- 2014-01-15 Andreas Krebbel * config/s390/s390.c (s390_preferred_reload_class): Don't return ADDR_REGS for invalid symrefs in non-PIC code. diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index d0e0f31..257e33c 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -3115,15 +3115,22 @@ s390_preferred_reload_class (rtx op, reg_class_t rclass) prefer ADDR_REGS. If 'class' is not a superset of ADDR_REGS, e.g. FP_REGS, reject this reload. */ case CONST: - /* A larl operand with odd addend will get fixed via secondary - reload. So don't request it to be pushed into literal - pool. */ + /* Symrefs cannot be pushed into the literal pool with -fPIC + so we *MUST NOT* return NO_REGS for these cases + (s390_cannot_force_const_mem will return true). + + On the other hand we MUST return NO_REGS for symrefs with + invalid addend which might have been pushed to the literal + pool (no -fPIC). Usually we would expect them to be + handled via secondary reload but this does not happen if + they are used as literal pool slot replacement in reload + inheritance (see emit_input_reload_insns). */ if (TARGET_CPU_ZARCH && GET_CODE (XEXP (op, 0)) == PLUS && GET_CODE (XEXP (XEXP(op, 0), 0)) == SYMBOL_REF && GET_CODE (XEXP (XEXP(op, 0), 1)) == CONST_INT) { - if (reg_class_subset_p (ADDR_REGS, rclass)) + if (flag_pic && reg_class_subset_p (ADDR_REGS, rclass)) return ADDR_REGS; else return NO_REGS; diff --git a/gcc/testsuite/gcc.c-torture/compile/pr59803.c b/gcc/testsuite/gcc.c-torture/compile/pr59803.c new file mode 100644 index 0000000..d2b5d20 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr59803.c @@ -0,0 +1,27 @@ +/* PR target/59803 */ + +extern void baz (void) __attribute__ ((__noreturn__)); +struct A { int g, h; }; +extern struct A a; +struct B { unsigned char i, j, k, l, m; }; +int c, d, e; +static int f; + +void +foo (void) +{ + f = 1; +} + +void +bar (struct B *x) +{ + x->i = e; + x->k = c; + x->l = d; + x->j = a.h; + x->m = f; + if (x->i != e) baz (); + if (x->k != c) baz (); + if (x->j != a.h) baz (); +}