From patchwork Thu Oct 20 15:28:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiong Wang X-Patchwork-Id: 78530 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp842941qge; Thu, 20 Oct 2016 08:29:20 -0700 (PDT) X-Received: by 10.99.157.75 with SMTP id i72mr1808624pgd.147.1476977360768; Thu, 20 Oct 2016 08:29:20 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id v17si42104865pgi.130.2016.10.20.08.29.20 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Oct 2016 08:29:20 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-439145-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-439145-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-439145-patch=linaro.org@gcc.gnu.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=qJn10oaY7SK+rHhF8ktHngISM11tgBl7CYX3CklwaV+eZ2LQ+C qxXH081GnUnZUlEemC9Jv8vhugeWrVXTi+yV+G4HYYc1PO8LmWkO73CCikRrCVTp w0dgvzVHxo2VeSEo+4uSXFtVlaexoFEpAoN0ytcB1Q9PZ4iwCV4WxNTak= 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 :from:subject:message-id:date:mime-version:content-type; s= default; bh=SuoHtPHd1QdvfXexGxwtvRJMbus=; b=b5+mJwF5qtgjmYYS+nrf PrnAVtWCONgzHuDkwkqPvkNt1kq+KVM3LLWhdQkQHcv9skMjB40TbTrC0Pg3oeVq RSojwN1wlweLNy9nYR2oe4eNkz7StQVul6mCdpYEVYkEuirQOaqqTkWo7zAaXGtY GRGhMPUJA8SLPK58fYHwDp0= Received: (qmail 36043 invoked by alias); 20 Oct 2016 15:28:51 -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 35994 invoked by uid 89); 20 Oct 2016 15:28:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=sk:jiongw, sk:jiong.w, U*jiong.wang X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 20 Oct 2016 15:28:50 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 27EA92B; Thu, 20 Oct 2016 08:28:49 -0700 (PDT) Received: from [10.2.206.198] (e104437-lin.cambridge.arm.com [10.2.206.198]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CE9D43F32C for ; Thu, 20 Oct 2016 08:28:48 -0700 (PDT) To: gcc-patches From: Jiong Wang Subject: [Patch] Don't expand targetm.stack_protect_fail if it's NULL_TREE Message-ID: Date: Thu, 20 Oct 2016 16:28:47 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 X-IsSubscribed: yes The current code suppose targetm.stack_protect_fail always generate something. But in case one target start to generate NULL_TREE, there will be ICE. This patch adds a simple sanity check to only call expand if it's not NULL_TREE. OK for trunk? gcc/ 2016-10-20 Jiong Wang * function.c (stack_protect_epilogue): Only expands targetm.stack_protect_fail if it's not NULL_TREE. diff --git a/gcc/function.c b/gcc/function.c index cdd2721cdf904be6457d090fe20345d3dee0b4dd..304c32ed2b1ace06139786680f30502d8483a8ed 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -5077,7 +5077,9 @@ stack_protect_epilogue (void) if (JUMP_P (tmp)) predict_insn_def (tmp, PRED_NORETURN, TAKEN); - expand_call (targetm.stack_protect_fail (), NULL_RTX, /*ignore=*/true); + tree fail_check = targetm.stack_protect_fail (); + if (fail_check != NULL_TREE) + expand_call (fail_check, NULL_RTX, /*ignore=*/true); free_temp_slots (); emit_label (label); }