From patchwork Thu Jan 4 10:11:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 123400 Delivered-To: patch@linaro.org Received: by 10.80.135.92 with SMTP id 28csp6529321edv; Thu, 4 Jan 2018 02:12:05 -0800 (PST) X-Google-Smtp-Source: ACJfBovPqrixKE+qSdcDmfiR6JXgDTD5kot5ln/mv3mhrflOgGJ5Ejg68nbNZr/oXBA7KxUOGJiY X-Received: by 10.99.102.1 with SMTP id a1mr3646462pgc.357.1515060725609; Thu, 04 Jan 2018 02:12:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515060725; cv=none; d=google.com; s=arc-20160816; b=dulSoK2j83dxxy/4pgKkvTXFcsJhh8rE0AEGFC5dRIZK66EQAIVh7w11YBj+Fi8Nr9 hHRc16hrYJelf2GcUaeOtTusCgQWG2AXT8QC0UErhdDhKI554KKmi8qy/m8NbwKyaBMa oM3QiTMY22iPeHYFTP+2NYgksthiVebCtSV2LVWgk07gngvDK3NBUlN9h5Is6825zYXz evLbhDrXcyAgSk84sR+i3AowMXN/Ywb6K2xSO362ZPI1lWT9alx6Q3d8ihcTG7xz/5UU ap2ApbzOLILHc1kOcLZLWgBy0VG9/OnCMef+1ZfOQRs3DRhpkpOV3WuGqt93t23iArO5 IGgg== 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=AQMb0T498TW5S/UD7vuP1MyogdEZZBTHrcC4c+Ntl6I=; b=j5bY2kAaIztUlTuX+nQfoV+Rm19PC+OmOO54DSJfn14NCqq2rDjknXxpER08RQPK+T Cna66ZeS53pFEhoyMsc95SJ6VpOFDUMGDx3KqED/wi+atnY6zNW6BCT0Ifb/6bfHyFVp MPNOAv+O+dnW7pbNratGP4eZBN2oxpOcH8afXwTQrwUQbPwNg2QEvyDlaHDvzuSsZoFT wnp/kNGASMj3hTrclB+RRdKJQVxTucCqmt/o7nduGklZ2NH1SWXnYrNbYf6KEav5E/6x zZIdzcEEtGmn9WT3w4CHc4qr0KcYxsEhrcCV9qyFbASPzKAE1iHJ1z2FsyZThzgRnEoN Pt8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=ueqaHArt; spf=pass (google.com: domain of gcc-patches-return-470128-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-470128-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 p9si1870965pgs.509.2018.01.04.02.12.05 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Jan 2018 02:12:05 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-470128-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=ueqaHArt; spf=pass (google.com: domain of gcc-patches-return-470128-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-470128-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=cc/JCnreiuxaTRc0WATgxQlxEPK+65HGuR8m+S+Taniz9JKIwPlwd cdTZnUdvDsD23FmFcDHIaXJdVi4jaJ5tLAuyhlQseCHIKprpAwCEIyGrB1KmDWXe zBP6oSnaNVpj5HA6rLbikZa4BoH22BmRSCY08yy9hjQvDkzGJ8TkSI= 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=AkzWRPIBPgVFJrHam+6AkpDX+rA=; b=ueqaHArtsU/eIKF4fd6d eNpXoBQt+/Hszcoql2Bj5JjZlTeTrJcEqXnn70URQ5MVW9l4BaJwwwXC4yX8DBvI wXeiCHnqO/BpT8I0zyVW5OwSHj/g6Um0WDrs1h8Kf+EiR8C/REN8MIeBaZX7GUiC OMWAANoDn+eoql8J9VkErUI= Received: (qmail 66429 invoked by alias); 4 Jan 2018 10:11: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 66420 invoked by uid 89); 4 Jan 2018 10:11:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=tree-vrp.c, UD:tree-vrp.c, treevrpc, protect X-HELO: mail-wr0-f175.google.com Received: from mail-wr0-f175.google.com (HELO mail-wr0-f175.google.com) (209.85.128.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 04 Jan 2018 10:11:49 +0000 Received: by mail-wr0-f175.google.com with SMTP id g17so989362wrd.13 for ; Thu, 04 Jan 2018 02:11:49 -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=AQMb0T498TW5S/UD7vuP1MyogdEZZBTHrcC4c+Ntl6I=; b=aSAukqSEvtWLgm1ifuYF7al2r3kpo21X/MGL0pWNM81XbY/chCcCXQeGZEBPB4SoUr N4ZTd2IjhzNGD5XeDDcWVenl6SKBKDvOsIqxz0ssKynzhzZoI6kuGZxriU+Cp49MXFDk 9MAFYhi/BVpH8NZIXIhVwcQ6PzRYZwLUCb3QFEZuWbHcFh/GgYqh4XDH9xEJDy1VqwD4 TnXDsf2s+GtZOZca2sd1id4QdKvKLy1mVEe/YfHerT+9+9BbQ+FiRBXAO9p/tJBWKsMQ f0TZL6xyKR+pTG0rdcHfwcZqmmxTtLHZ/eL2hv3UHQRrARP3qzYWpOEDbfGRo8EOZ/CI mdMQ== X-Gm-Message-State: AKGB3mK/O5XlX6Pn9VAnxmCu6NmadbgIlzr8bEJIeMZ6rKSy4pwboz2g IpAqnzhs8KH7frTG8vpduqpRDMy7qm8= X-Received: by 10.223.148.97 with SMTP id 88mr4570291wrq.265.1515060707305; Thu, 04 Jan 2018 02:11:47 -0800 (PST) Received: from localhost ([95.144.14.233]) by smtp.gmail.com with ESMTPSA id o98sm10387661wrb.40.2018.01.04.02.11.46 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 04 Jan 2018 02:11:46 -0800 (PST) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: Protect second call to extract_range_from_multiplicative_op_1 Date: Thu, 04 Jan 2018 10:11:46 +0000 Message-ID: <87efn6hr19.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Following on from: * tree-vrp.c (extract_range_from_multiplicative_op_1): Assert for VR_RANGE only; don't allow VR_ANTI_RANGE. (extract_range_from_binary_expr_1): Don't call extract_range_from_multiplicative_op_1 if !range_int_cst_p. there was a later call to extract_range_from_multiplicative_op_1 too, that used a negative test for a symbolic (!is_gimple_min_invariant) range rather than a positive test for an integer range. Tested on aarch64-linux-gnu, x86_64-linux-gnu and powerpc64le-linux-gnu. Also tested by comparing the before and after assembly output for at least one target per CPU directory. OK to install? Richard 2018-01-04 Richard Sandiford gcc/ * tree-vrp.c (extract_range_from_binary_expr_1): Check range_int_cst_p rather than !symbolic_range_p before calling extract_range_from_multiplicative_op_1. Index: gcc/tree-vrp.c =================================================================== --- gcc/tree-vrp.c 2018-01-03 11:12:55.826759160 +0000 +++ gcc/tree-vrp.c 2018-01-04 10:09:44.701136182 +0000 @@ -2042,7 +2042,7 @@ extract_range_from_binary_expr_1 (value_ return; } } - else if (!symbolic_range_p (&vr0) && !symbolic_range_p (&vr1)) + else if (range_int_cst_p (&vr0) && range_int_cst_p (&vr1)) { extract_range_from_multiplicative_op_1 (vr, code, &vr0, &vr1); return;