From patchwork Tue Mar 14 00:04:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Schmidt X-Patchwork-Id: 738485 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 3vhw3R349rz9s3w for ; Tue, 14 Mar 2017 11:05:05 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="gpH1+qaQ"; 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=fLN03 BsiLsVc+dIEsMB05tZnsSI6tAm/KFvHxZQp2S90ETHYltr6RWA2hgJcXBkaTHmyd xCol2dunpoboKAMzXMs0dHYJMxP5lBvWN/bAfysLIM9M1mgmf7i6gcExYcJZBxz8 gLBfEF3QHLHUJsZi1pvQQVsl8q8r5IT3eeBPw0= 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=Pozkb0FUN5T vMpoWO8LoV30XUPA=; b=gpH1+qaQtwh14xNJA0GT8n8E1khWo59erh0dXZ+u+eV evta5eZDWLC7/PLH7/XILupAcCF8I4DMajd9VKW5oubprZRuO2OZtCxXKeZd3Afi HKC/utQM21GnWY/OMVSV0bivx3kFbS//sllphuJodT9BmV69inrxVdfDRm+WnncQ = Received: (qmail 28749 invoked by alias); 14 Mar 2017 00:04:54 -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 28719 invoked by uid 89); 14 Mar 2017 00:04:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.0 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=that!, Hx-languages-length:1716 X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0a-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.156.1) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 14 Mar 2017 00:04:52 +0000 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v2E04PbR111602 for ; Mon, 13 Mar 2017 20:04:50 -0400 Received: from e13.ny.us.ibm.com (e13.ny.us.ibm.com [129.33.205.203]) by mx0a-001b2d01.pphosted.com with ESMTP id 295yydecwh-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 13 Mar 2017 20:04:50 -0400 Received: from localhost by e13.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 13 Mar 2017 20:04:49 -0400 Received: from b03cxnp08026.gho.boulder.ibm.com (9.17.130.18) by e13.ny.us.ibm.com (146.89.104.200) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 13 Mar 2017 20:04:46 -0400 Received: from b03ledav002.gho.boulder.ibm.com (b03ledav002.gho.boulder.ibm.com [9.17.130.233]) by b03cxnp08026.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v2E04kF610486240; Mon, 13 Mar 2017 17:04:46 -0700 Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2856C13603C; Mon, 13 Mar 2017 18:04:46 -0600 (MDT) Received: from bigmac.rchland.ibm.com (unknown [9.10.86.201]) by b03ledav002.gho.boulder.ibm.com (Postfix) with ESMTP id EC306136049; Mon, 13 Mar 2017 18:04:45 -0600 (MDT) To: GCC Patches Cc: Richard Biener From: Bill Schmidt Subject: [PATCH] Fix PR79908 Date: Mon, 13 Mar 2017 19:04:45 -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: 17031400-0008-0000-0000-000001BDC760 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00006777; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000206; SDB=6.00833430; UDB=6.00409179; IPR=6.00611088; BA=6.00005207; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00014636; XFM=3.00000013; UTC=2017-03-14 00:04:47 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17031400-0009-0000-0000-000033C8FC8A Message-Id: <1698034f-0529-cc1c-2ffd-745d5193144e@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-03-13_18:, , 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-1703140000 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. The expression is not addressable, so the gimplification fails. This patch says, hey, don't do that! The resulting GIMPLE looks fine afterward. Bootstrapped and tested on powerpc64le-unknown-linux-gnu with no regressions. Is this ok for trunk? Thanks, Bill [gcc] 2017-03-13 Bill Schmidt PR tree-optimization/79908 * tree-stdarg.c (expand_ifn_va_arg_1): Don't force something to be an lvalue that isn't addressable. [gcc/testsuite] 2017-03-13 Bill Schmidt PR tree-optimization/79908 * gcc.dg/torture/pr79908.c: New file. Index: gcc/testsuite/gcc.dg/torture/pr79908.c =================================================================== --- gcc/testsuite/gcc.dg/torture/pr79908.c (nonexistent) +++ 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 246109) +++ gcc/tree-stdarg.c (working copy) @@ -1057,7 +1057,7 @@ expand_ifn_va_arg_1 (function *fun) types. */ gimplify_assign (lhs, expr, &pre); } - else + else if (is_gimple_addressable (expr)) gimplify_expr (&expr, &pre, &post, is_gimple_lvalue, fb_lvalue); input_location = saved_location;