From patchwork Tue Jan 23 11:25:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 125497 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1695378ljf; Tue, 23 Jan 2018 03:26:02 -0800 (PST) X-Google-Smtp-Source: AH8x2250CiByDx8QxGkTz9tisbxRmiGjKqjaPJHEQnDguIKnfbg/8+MYmTOfbWLWvCEdRm8OYR23 X-Received: by 2002:a17:902:59c2:: with SMTP id d2-v6mr5493877plj.306.1516706762746; Tue, 23 Jan 2018 03:26:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516706762; cv=none; d=google.com; s=arc-20160816; b=c6XSGSBEq+jQ5QWHiXUF9jx2QgNrtrYS31ZBKnA2S/QigaODBFgnt8EFE632wgi7as ynBdPF+ekXOTZe0F5/SLgRXjR9DOoZ9dMN+Ipyqo+ZwCNqrOTrMmGtXfYLHPNUkinq5a DTIv6AtuO8nuBHH6waOrFNsWm2eH6SDPz3BbRf57c5QitsnWTScyq01h+C5SnUexY8q7 eCPJjRw4W59rV7Dg07imvNmMsDCeGaO3ATT8XzgGFjNnvKwscJlMhfmzTkc/SM94otWt r+/XhOEHVR9Dy42uIjCM21fpcld+kDiWxmuFpnFwbKo8xhprZDaK8t68dQaevkpIY/HE KSzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:message-id:date:subject:mail-followup-to:to :from:delivered-to:sender:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mailing-list:dkim-signature :domainkey-signature:arc-authentication-results; bh=SFkhj78F5AcjQqhcn+xRZCxfYvP+wpIRl8ir7R/WbKE=; b=CrbW3n5j4rpST+rX0Zq7KF+TAF9LoLHqX1Z8sBRcEmiloSROzupVmJonL2KMH/9Gfg 5KXY1GqaoNUUR7EUQ4up5kDurGWTNW6eN0+s6BaL3nTHLIg1hyz+JKMvp6qFFQAJ/DBg YxLrORS15a72ckGsEOFaV/+9vdlf7B11Uy3vAb8RuPfxpqVa5tOpiq78EQOmAhsCYmlR zkXJFoTc5pcvdXPHvCStOOhfVMNtLMuptJH630kwVqXzbNrXT+5IvE4naSzOyYPYQBwC jMDpptcNXFTJK7V2svTAaO6guV8mr8rHM1euaMOH5H/h9DTE8WsHNbkDs4VYDTHHieoK mwCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=sNeJMQf7; spf=pass (google.com: domain of gcc-patches-return-471866-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-471866-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id h6-v6si4598855pll.602.2018.01.23.03.26.02 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Jan 2018 03:26:02 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-471866-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 header.s=default header.b=sNeJMQf7; spf=pass (google.com: domain of gcc-patches-return-471866-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-471866-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; q=dns; s= default; b=Dyb7Ph+a1wPbHdMqE9qSKxd/ynDsNQ8noUJ1xZ27U/B3QONk/kqQt liQO10l0xbovxW2pqSj4NB+8tAP51rQe5iD+pyNeyJnESkHlCzDD50oInq1e0em6 Ut0/kgirxtNrX1n57SpY6tKcBV5zFSxoV1Zr6Bu/IKx/GjnAHjv3S4= 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:from :to:subject:date:message-id:mime-version:content-type; s= default; bh=nk2f3plkjJd7aCHxkqoMcKl02mM=; b=sNeJMQf7ri5fCL7IuK0M +Sl/EgGGgWn5mv95PHiQckLNhb8BlboA/MPiakGiauFX0bQRvw+he4DR5IZ76U5V VqIz4eBGhLcz6/xePj6qh611N/mckc3nduLy0C8cFUDKcoojuE2TlQtjIZRaB+bC 1/N3l52dHRmxMz7sZ7e1GqQ= Received: (qmail 62161 invoked by alias); 23 Jan 2018 11:25:50 -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 62121 invoked by uid 89); 23 Jan 2018 11:25:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-ot0-f175.google.com Received: from mail-ot0-f175.google.com (HELO mail-ot0-f175.google.com) (74.125.82.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 23 Jan 2018 11:25:45 +0000 Received: by mail-ot0-f175.google.com with SMTP id x15so114821ote.1 for ; Tue, 23 Jan 2018 03:25:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:mail-followup-to:subject:date:message-id :user-agent:mime-version; bh=SFkhj78F5AcjQqhcn+xRZCxfYvP+wpIRl8ir7R/WbKE=; b=ZqIBZD+iDVquTzXSS/Kbt2sMC8hVaL+5fIJKj17lTQXn6RCVijMUEB8TSPyxwzgjPZ /hB1Mcp6E9bsF+LtnTPn1hCcd3oSg1k5KFfSM9EWKmHEDqTcJIYK4GuuPLK/SNmzWKlz AAxBhpRCwLwT+6+S4uhESjDpXLBaXLRQLza9nLnnJudrf4u4gpwXa0jkE1J9L9yb3MrZ iXU+1UH/MmUA7ohXaQq0Hl1QUBQvF1OLZgb1PGeemzFtQlQ7rtwu8mSuMBFKPODACbt4 HKNuNIW6jIgt3P95llXX69c6g/A3Hd/VE9m/mUTyYrBFr0WNfObD8LMfw7gAbZHMRG1T VUBw== X-Gm-Message-State: AKwxytcKtScwfg4ydfxd9KrMoTMR3mZ6Gm9aV1YXgMJzPylQ4YWWeEAA h2VkFX2mVoxaxxMOkaQa/i52S5f+F2w= X-Received: by 10.157.51.132 with SMTP id u4mr6141480otc.323.1516706743227; Tue, 23 Jan 2018 03:25:43 -0800 (PST) Received: from localhost ([95.144.14.233]) by smtp.gmail.com with ESMTPSA id d36sm1113618oic.8.2018.01.23.03.25.41 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Jan 2018 03:25:42 -0800 (PST) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: Fix use of boolean_true/false_node (PR 83979) Date: Tue, 23 Jan 2018 11:25:39 +0000 Message-ID: <87lggo4y18.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 r255913 changed some constant_boolean_node calls to boolean_true_node and boolean_false_node, which meant that the returned tree didn't always have the right type. Tested on aarch64-linux-gnu. Probably bordering on obvious, but just in case: OK to install? Richard 2018-01-23 Richard Sandiford gcc/ PR tree-optimization/83979 * fold-const.c (fold_comparison): Use constant_boolean_node instead of boolean_{true,false}_node. gcc/testsuite/ PR tree-optimization/83979 * g++.dg/pr83979.c: New test. Index: gcc/fold-const.c =================================================================== --- gcc/fold-const.c 2018-01-16 15:13:19.643832679 +0000 +++ gcc/fold-const.c 2018-01-23 11:23:59.982555852 +0000 @@ -8572,39 +8572,39 @@ fold_comparison (location_t loc, enum tr { case EQ_EXPR: if (known_eq (bitpos0, bitpos1)) - return boolean_true_node; + return constant_boolean_node (true, type); if (known_ne (bitpos0, bitpos1)) - return boolean_false_node; + return constant_boolean_node (false, type); break; case NE_EXPR: if (known_ne (bitpos0, bitpos1)) - return boolean_true_node; + return constant_boolean_node (true, type); if (known_eq (bitpos0, bitpos1)) - return boolean_false_node; + return constant_boolean_node (false, type); break; case LT_EXPR: if (known_lt (bitpos0, bitpos1)) - return boolean_true_node; + return constant_boolean_node (true, type); if (known_ge (bitpos0, bitpos1)) - return boolean_false_node; + return constant_boolean_node (false, type); break; case LE_EXPR: if (known_le (bitpos0, bitpos1)) - return boolean_true_node; + return constant_boolean_node (true, type); if (known_gt (bitpos0, bitpos1)) - return boolean_false_node; + return constant_boolean_node (false, type); break; case GE_EXPR: if (known_ge (bitpos0, bitpos1)) - return boolean_true_node; + return constant_boolean_node (true, type); if (known_lt (bitpos0, bitpos1)) - return boolean_false_node; + return constant_boolean_node (false, type); break; case GT_EXPR: if (known_gt (bitpos0, bitpos1)) - return boolean_true_node; + return constant_boolean_node (true, type); if (known_le (bitpos0, bitpos1)) - return boolean_false_node; + return constant_boolean_node (false, type); break; default:; } Index: gcc/testsuite/g++.dg/pr83979.c =================================================================== --- /dev/null 2018-01-22 18:46:35.983712806 +0000 +++ gcc/testsuite/g++.dg/pr83979.c 2018-01-23 11:23:59.982555852 +0000 @@ -0,0 +1,7 @@ +/* { dg-compile } */ + +int +foo (char* p) +{ + return p + 1000 < p; +}