From patchwork Sun Dec 11 21:31:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bill Schmidt X-Patchwork-Id: 704875 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 3tcK1D3xhCz9s2G for ; Mon, 12 Dec 2016 08:31:57 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="bDqGzHPB"; 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 :subject:to:references:cc:from:date:mime-version:in-reply-to :content-type:content-transfer-encoding:message-id; q=dns; s= default; b=vGgSh6AVZv2nXrVTMXrKkMTmAA54ZUIcK6fiT/H+7tV++2fQVgdBW hAwN83mGyp43iMWs7cmNdmIdoxnCU9xpNnxBFYgRvUdvx/C4PSRZaBRyqyL13nOl 5xxpsPMIV7BXEI4gCrlz6xAlKLr8tz7Sf/xDEAAYw1HzCmR/AA5kp4= 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 :subject:to:references:cc:from:date:mime-version:in-reply-to :content-type:content-transfer-encoding:message-id; s=default; bh=GtGCm8S0LNbal2aWE5WPoUdywOw=; b=bDqGzHPB7EcTsqPc54yF1B6sgjap ZZzHLbhcwWoOokQ6iyRrjWWhq4yZSfC8TljWpCoihdQuH23EPKmbWkAwbFW8eMIw Xs7thoyMWzpEcBBrn7WSflJjpSRkAdJWSNkK9yGylTke54y1vnmD3cy3DrEnldbN Aa+eiiX3eBnVo7Q= Received: (qmail 63526 invoked by alias); 11 Dec 2016 21:31:48 -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 63477 invoked by uid 89); 11 Dec 2016 21:31:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: =?ISO-8859-1?Q?No, score=-0.8 required=5.0 tests=AWL, BAYES_00, KAM_ASCII_DIVIDERS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy==ef=bb=bf, Hx-languages-length:1982, sk:swapss, UD:swaps-stack-protector.c?= 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; Sun, 11 Dec 2016 21:31:43 +0000 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id uBBLSfb7030532 for ; Sun, 11 Dec 2016 16:31:41 -0500 Received: from e18.ny.us.ibm.com (e18.ny.us.ibm.com [129.33.205.208]) by mx0a-001b2d01.pphosted.com with ESMTP id 279dqb9kf0-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Sun, 11 Dec 2016 16:31:41 -0500 Received: from localhost by e18.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 11 Dec 2016 16:31:39 -0500 Received: from d01dlp03.pok.ibm.com (9.56.250.168) by e18.ny.us.ibm.com (146.89.104.205) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Sun, 11 Dec 2016 16:31:37 -0500 Received: from b01cxnp22033.gho.pok.ibm.com (b01cxnp22033.gho.pok.ibm.com [9.57.198.23]) by d01dlp03.pok.ibm.com (Postfix) with ESMTP id 8878EC90045; Sun, 11 Dec 2016 16:31:19 -0500 (EST) Received: from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com [9.57.199.110]) by b01cxnp22033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id uBBLVaTa38862952; Sun, 11 Dec 2016 21:31:36 GMT Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5688CAE034; Sun, 11 Dec 2016 16:31:36 -0500 (EST) Received: from BigMac.local (unknown [9.80.220.149]) by b01ledav005.gho.pok.ibm.com (Postfix) with ESMTP id 17A00AE043; Sun, 11 Dec 2016 16:31:36 -0500 (EST) Subject: Re: [PATCH, rs6000] Fix PR78695 To: Segher Boessenkool References: <20161211200042.GB30845@gate.crashing.org> Cc: GCC Patches , David Edelsohn From: Bill Schmidt Date: Sun, 11 Dec 2016 15:31:35 -0600 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20161211200042.GB30845@gate.crashing.org> X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16121121-0044-0000-0000-000002000685 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00006225; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000196; SDB=6.00792453; UDB=6.00384088; IPR=6.00570252; BA=6.00004957; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00013591; XFM=3.00000011; UTC=2016-12-11 21:31:38 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16121121-0045-0000-0000-0000062C16BF Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-12-11_15:, , 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-1609300000 definitions=main-1612110342 X-IsSubscribed: yes Hi Segher, On 12/11/16 2:00 PM, Segher Boessenkool wrote: > Maybe this should use DF_REF_IS_ARTIFICIAL? Or if that doesn't work, > DF_REF_INSN_INFO? > OK, currently regstrapping the following, which also fixes the problem with a non-bootstrap compiler. Is this ok for trunk if it succeeds? Thanks, Bill [gcc] 2016-12-11 Bill Schmidt PR target/78695 * config/rs6000/rs6000.c (find_alignment_op): Discard from consideration any artificial definition. [gcc/testsuite] 2016-12-11 Bill Schmidt PR target/78695 * gcc.target/powerpc/swaps-stack-protector.c: New test. Index: gcc/config/rs6000/rs6000.c =================================================================== --- gcc/config/rs6000/rs6000.c (revision 243506) +++ gcc/config/rs6000/rs6000.c (working copy) @@ -41433,6 +41433,12 @@ find_alignment_op (rtx_insn *insn, rtx base_reg) if (!base_def_link || base_def_link->next) break; + /* With stack-protector code enabled, and possibly in other + circumstances, there may not be an associated insn for + the def. */ + if (DF_REF_CLASS (base_def_link->ref) == DF_REF_ARTIFICIAL) + break; + rtx_insn *and_insn = DF_REF_INSN (base_def_link->ref); and_operation = alignment_mask (and_insn); if (and_operation != 0) Index: gcc/testsuite/gcc.target/powerpc/swaps-stack-protector.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/swaps-stack-protector.c (revision 0) +++ gcc/testsuite/gcc.target/powerpc/swaps-stack-protector.c (working copy) @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-fstack-protector -O3" } */ + +/* PR78695: This code used to ICE in rs6000.c:find_alignment_op because + the stack protector address definition isn't associated with an insn. */ + +void *a(); +long b() { + char c[1]; + char *d = a(), *e = c; + long f = e ? b(e) : 0; + if (f > 54) + f = 1; + while (f--) + *d++ = *e++; +}