From patchwork Wed Mar 22 15:43:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Schmidt X-Patchwork-Id: 742150 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 3vpDW45tq1z9s0Z for ; Thu, 23 Mar 2017 02:43:59 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="LniuxEg9"; 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:to:cc :from:subject:date:mime-version:content-type :content-transfer-encoding:message-id; q=dns; s=default; b=fi1+K 4FHhHJ6cX0NlQpEaB88zFvdPuchHbLHI6JtN7yeVZETKNnYxWjBseF3JQ9nrlJLa RSfo6XV05UyRvYU022vi/+TSx6w9Unp1D+aY7Nk+pZc/pzNrbB8iRP8mx7ZtyAdt yQqXJwz2BlTaUpdNa9bIpGlYmgeVYvCySouJXE= 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:to:cc :from:subject:date:mime-version:content-type :content-transfer-encoding:message-id; s=default; bh=6zADc+Z6Imz oJT5xOY2GfpLW0Wc=; b=LniuxEg9Q+dpHoaUECC9aoF3ZjwsCx5e9MNVmhM24gF dOR2ws+oGaSLrHHAm4dQCodnhykkhc9NXrn5VazqMJTSDbfUa7lXCeluNdmBMU+E XHDMDyT5y+nwFPbMaUJauUK/0XvZ1qq1H8foDUwMyodFyX6f2Q9+uQpkpOhhsl1Y = Received: (qmail 61566 invoked by alias); 22 Mar 2017 15:43:46 -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 60993 invoked by uid 89); 22 Mar 2017 15:43:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=farm X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0b-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.158.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 22 Mar 2017 15:43:43 +0000 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v2MFe2Lp092482 for ; Wed, 22 Mar 2017 11:43:42 -0400 Received: from e13.ny.us.ibm.com (e13.ny.us.ibm.com [129.33.205.203]) by mx0b-001b2d01.pphosted.com with ESMTP id 29b9vqcm3x-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 22 Mar 2017 11:43:42 -0400 Received: from localhost by e13.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 22 Mar 2017 11:43:41 -0400 Received: from b01cxnp23032.gho.pok.ibm.com (9.57.198.27) by e13.ny.us.ibm.com (146.89.104.200) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 22 Mar 2017 11:43:36 -0400 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp23032.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v2MFhZWD39649508; Wed, 22 Mar 2017 15:43:35 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 69A6DAC040; Wed, 22 Mar 2017 11:43:28 -0400 (EDT) Received: from bigmac.rchland.ibm.com (unknown [9.10.86.201]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTP id 2CF69AC04A; Wed, 22 Mar 2017 11:43:28 -0400 (EDT) To: GCC Patches Cc: Richard Biener , james.greenhalgh@arm.com, christophe.lyon@linaro.org From: Bill Schmidt Subject: [PATCH v3] Fix PR79908 (and PR80136) Date: Wed, 22 Mar 2017 10:43:34 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 17032215-0008-0000-0000-000001D25B0E X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00006829; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000206; SDB=6.00837362; UDB=6.00411648; IPR=6.00615129; BA=6.00005231; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00014757; XFM=3.00000013; UTC=2017-03-22 15:43:40 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17032215-0009-0000-0000-00003409C5B5 Message-Id: <506a9fff-f866-16c5-7440-7637099c9855@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-03-22_12:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1702020001 definitions=main-1703220136 X-IsSubscribed: yes Hi, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79908 shows a case where pass_stdarg ICEs attempting to gimplify a COMPLEX_EXPR with side effects as an lvalue. This occurs when the LHS of a VA_ARG has been cast away. The previous patch (reverted) used force_gimple_operand to instantiate the necessary side effects rather than gimplify_expr using is_gimple_lvalue. This proved to cause problems on some targets where the gimple expression produced by targetm.gimplify_va_arg_expr contains un-gimplified side effects using raw var_decls (see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80136). After some investigation, the right fix seems to be to just call gimplify_and_add on the expression. I've bootstrapped and tested this on powerpc64le-unknown-linux-gnu with no regressions. I've also built a ppc64le->aarch64 cross and verified that Christophe's original report from PR80136 is now fixed. I don't have immediate access to an aarch64 native system (compile farm authentication issues), so I would appreciate it if James could run a native bootstrap to see if his issues are resolved. Provided there are no issues uncovered with aarch64 native bootstrap, is this ok for trunk? Thanks, Bill [gcc] 2017-03-21 Bill Schmidt Richard Biener PR tree-optimization/79908 PR tree-optimization/80136 * tree-stdarg.c (expand_ifn_va_arg_1): For a VA_ARG whose LHS has been cast away, gimplify_and_add suffices. [gcc/testsuite] 2017-03-21 Bill Schmidt Richard Biener PR tree-optimization/79908 PR tree-optimization/80136 * gcc.dg/torture/pr79908.c: New file. Index: gcc/testsuite/gcc.dg/torture/pr79908.c =================================================================== --- gcc/testsuite/gcc.dg/torture/pr79908.c (revision 246334) +++ gcc/testsuite/gcc.dg/torture/pr79908.c (working copy) @@ -0,0 +1,12 @@ +/* { dg-do compile } */ + +/* Used to fail in the stdarg pass before fix for PR79908. */ + +typedef __builtin_va_list __gnuc_va_list; +typedef __gnuc_va_list va_list; + +void testva (int n, ...) +{ + va_list ap; + _Complex int i = __builtin_va_arg (ap, _Complex int); +} Index: gcc/tree-stdarg.c =================================================================== --- gcc/tree-stdarg.c (revision 246334) +++ gcc/tree-stdarg.c (working copy) @@ -1058,7 +1058,7 @@ expand_ifn_va_arg_1 (function *fun) gimplify_assign (lhs, expr, &pre); } else - gimplify_expr (&expr, &pre, &post, is_gimple_lvalue, fb_lvalue); + gimplify_and_add (expr, &pre); input_location = saved_location; pop_gimplify_context (NULL);