From patchwork Wed Jul 19 16:25:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 791166 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-458528-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="IDq8E08D"; dkim-atps=neutral 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 3xCMnx4z40z9s8J for ; Thu, 20 Jul 2017 02:25:23 +1000 (AEST) 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=Su3iXTf09Sd/pbbg4Rnv3D2DdAHWMZ2JvLazcJ1iJ2x9ewA922 6D/+ehqhzSgI2vmcNZdw1GKdB8Q82RZezR/ZzBfJw2dAS/iQ+QWATUwoaF+bAk1I qq/d1/Nald9vjRau8QCoaMEWsQ82kwVCfcY7+kDt/uZLgePjhbmGWU1QY= 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=U+IQYF+3PIf2h9qJl7rMfMVDiE4=; b=IDq8E08DomNPBfvUn/I8 D/2KmX5qR5Ks6Lb9BNsoe69/VPIvSzi0cQTN4AMCtjTEh/Flf5eHvaM23oGwrzRK f3oeR6uNufC8dFDOc26r25npV+wdx+7RYaYC3ZF9PoItXQjtiIlm+BuiRVsDOH6X 4v2DeOUGAu25L1My4WSVGGE= Received: (qmail 22615 invoked by alias); 19 Jul 2017 16:25:16 -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 22587 invoked by uid 89); 19 Jul 2017 16:25:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS, URIBL_RED autolearn=ham version=3.3.2 spammy=Hx-languages-length:1056 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 19 Jul 2017 16:25:13 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-MBX-04.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1dXrmh-0002RK-6k from Tom_deVries@mentor.com for gcc-patches@gcc.gnu.org; Wed, 19 Jul 2017 09:25:11 -0700 Received: from [127.0.0.1] (137.202.0.87) by SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Wed, 19 Jul 2017 17:25:07 +0100 To: GCC Patches From: Tom de Vries Subject: [committed] Fix assert in gimple_phi_set_arg Message-ID: <926f1bae-4952-1e69-a59d-dc192badf481@mentor.com> Date: Wed, 19 Jul 2017 18:25:02 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 X-ClientProxiedBy: svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) To SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) Hi, this patch makes an assert in gimple_phi_set_arg more strict. The current assert allows 'index == phi->nargs'. While it's true that there are access functions that currently use the nargs..(capacity-1) inclusive range, this is not one of them (and if it was, the condition should be 'index < phi->capacity'). Bootstrapped and reg-tested on x86_64. Committed as obvious. Thanks, - Tom Fix assert in gimple_phi_set_arg 2017-07-19 Tom de Vries * gimple.h (gimple_phi_set_arg): Make assert more strict. --- gcc/gimple.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/gimple.h b/gcc/gimple.h index e19cc1c..aba7167 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -4351,7 +4351,7 @@ gimple_phi_arg (gimple *gs, unsigned index) static inline void gimple_phi_set_arg (gphi *phi, unsigned index, struct phi_arg_d * phiarg) { - gcc_gimple_checking_assert (index <= phi->nargs); + gcc_gimple_checking_assert (index < phi->nargs); phi->args[index] = *phiarg; }