From patchwork Wed Jul 8 21:16:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 493167 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 0D156140A9A for ; Thu, 9 Jul 2015 07:16:37 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=ctfcZB/j; dkim-atps=neutral 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:cc:subject:message-id:reply-to:mime-version :content-type; q=dns; s=default; b=Td0LqqGBrlIz+nmXsDla+8Z3if3pE QVVSvHpiWgHQONWYCh6PFxnzdwc2jJcrTr7PdlvVz9zGttLFvchpLNIPLjW0dHYg Yve9xjUtkdBHtj554eBIzGwxV2wAhMrhoYHHxRb223Tq7VWUTbgQ0755hgK7Oerz igMhlzJE5GA8CY= 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:cc:subject:message-id:reply-to:mime-version :content-type; s=default; bh=8iWnx8PG2zzbABcU2n2y+5E/Hvs=; b=ctf cZB/jF/NZbOkts90RQ9oS0vmujfqAV6CKSXgCp7RYuAakjAIKj4bhkn+TnTY+7E8 Q0DVKxOAQ+hTdbpqCAWgAynJ5CffLbkPNsLXl7T5UZi1tpabbpFxRKunGr1F0Kef BkBhrEF2TCoBOUWZncfm1k0uzMGgN0EDI6vnYTCw= Received: (qmail 52143 invoked by alias); 8 Jul 2015 21:16:28 -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 52129 invoked by uid 89); 8 Jul 2015 21:16:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, NO_DNS_FOR_FROM, RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: mga11.intel.com Received: from mga11.intel.com (HELO mga11.intel.com) (192.55.52.93) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 08 Jul 2015 21:16:26 +0000 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP; 08 Jul 2015 14:16:24 -0700 X-ExtLoop1: 1 Received: from gnu-6.sc.intel.com ([172.25.70.52]) by orsmga002.jf.intel.com with ESMTP; 08 Jul 2015 14:16:25 -0700 Received: by gnu-6.sc.intel.com (Postfix, from userid 1000) id 88539C41EC; Wed, 8 Jul 2015 14:16:24 -0700 (PDT) Date: Wed, 8 Jul 2015 14:16:24 -0700 From: "H.J. Lu" To: gcc-patches@gcc.gnu.org Cc: Uros Bizjak Subject: [PATCH] PR target/66817: Check int_size_in_bytes in ix86_return_in_memory Message-ID: <20150708211624.GA17573@intel.com> Reply-To: "H.J. Lu" MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) ix86_return_in_memory should check negative return from int_size_in_bytes, similar to other ports. Tested on Linux/x86-64. OK for trunk? Thanks. H.J. --- gcc/ PR target/66817 * config/i386/i386.c (ix86_return_in_memory): Return true if int_size_in_bytes returns negative for IA MCU. gcc/testsuite/ PR target/66817 * gcc.target/i386/pr66817.c: New test. --- gcc/config/i386/i386.c | 2 +- gcc/testsuite/gcc.target/i386/pr66817.c | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr66817.c diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 55a32ac..54ee6f3 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -8682,7 +8682,7 @@ ix86_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED) /* Intel MCU psABI returns scalars and aggregates no larger than 8 bytes in registers. */ if (TARGET_IAMCU) - return VECTOR_MODE_P (mode) || size > 8; + return VECTOR_MODE_P (mode) || size < 0 || size > 8; if (mode == BLKmode) return true; diff --git a/gcc/testsuite/gcc.target/i386/pr66817.c b/gcc/testsuite/gcc.target/i386/pr66817.c new file mode 100644 index 0000000..7ec18b7 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr66817.c @@ -0,0 +1,27 @@ +/* { dg-do compile { target ia32 } } */ +/* { dg-options "-O2 -mno-sse -mno-mmx -miamcu" } */ + +extern void abort (void); +int +main (int argc, char **argv) +{ + int size = 10; + typedef struct + { + char val[size]; + } + block; + block a, b; + block __attribute__((noinline)) + retframe_block () + { + return *(block *) &b; + } + b.val[0] = 1; + b.val[9] = 2; + a=retframe_block (); + if (a.val[0] != 1 + || a.val[9] != 2) + abort (); + return 0; +}