[{"id":1772013,"web_url":"http://patchwork.ozlabs.org/comment/1772013/","msgid":"<CAFiYyc3Yis6b1_BEnPNnXcdADsY0kCKW7Mz1D0C_BUJ_ZMQ6HQ@mail.gmail.com>","list_archive_url":null,"date":"2017-09-20T15:55:43","subject":"Re: Add missing int_cst_rangeN checks to tree-vrp.c","submitter":{"id":1765,"url":"http://patchwork.ozlabs.org/api/people/1765/","name":"Richard Biener","email":"richard.guenther@gmail.com"},"content":"On Wed, Sep 20, 2017 at 2:09 PM, Richard Sandiford\n<richard.sandiford@linaro.org> wrote:\n> The BIT_AND_EXPR handling in extract_range_from_binary_expr_1\n> was using value_range_constant_singleton without first checking\n> whether the range was a constant.  The earlier handling was correctly\n> guarded:\n>\n>           /* If either input range contains only non-negative values\n>              we can truncate the result range maximum to the respective\n>              maximum of the input range.  */\n>           if (int_cst_range0 && tree_int_cst_sgn (vr0.min) >= 0)\n>             wmax = wi::min (wmax, vr0.max, TYPE_SIGN (expr_type));\n>           if (int_cst_range1 && tree_int_cst_sgn (vr1.min) >= 0)\n>             wmax = wi::min (wmax, vr1.max, TYPE_SIGN (expr_type));\n>\n> so this patch uses the same guards again.\n>\n> Existing tests showed the need for this once polynomial constants\n> are added.\n>\n> Tested on aarch64-linux-gnu, x86_64-linux-gnu and powerpc64le-linus-gnu.\n> OK to install?\n\nOk.\n\nRichard.\n\n> Richard\n>\n>\n> 2017-09-20  Richard Sandiford  <richard.sandiford@linaro.org>\n>             Alan Hayward  <alan.hayward@arm.com>\n>             David Sherwood  <david.sherwood@arm.com>\n>\n> gcc/\n>         * tree-vrp.c (extract_range_from_binary_expr_1): Check\n>         int_cst_rangeN before calling value_range_constant_singleton (&vrN).\n>\n> Index: gcc/tree-vrp.c\n> ===================================================================\n> --- gcc/tree-vrp.c      2017-09-20 13:04:29.932873038 +0100\n> +++ gcc/tree-vrp.c      2017-09-20 13:07:32.589667751 +0100\n> @@ -2930,9 +2930,11 @@ extract_range_from_binary_expr_1 (value_\n>                 = wi::set_bit_in_zero (TYPE_PRECISION (expr_type) - 1,\n>                                        TYPE_PRECISION (expr_type));\n>               if (!TYPE_UNSIGNED (expr_type)\n> -                 && ((value_range_constant_singleton (&vr0)\n> +                 && ((int_cst_range0\n> +                      && value_range_constant_singleton (&vr0)\n>                        && !wi::cmps (vr0.min, sign_bit))\n> -                     || (value_range_constant_singleton (&vr1)\n> +                     || (int_cst_range1\n> +                         && value_range_constant_singleton (&vr1)\n>                           && !wi::cmps (vr1.min, sign_bit))))\n>                 {\n>                   min = TYPE_MIN_VALUE (expr_type);","headers":{"Return-Path":"<gcc-patches-return-462614-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-462614-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"tPA5aZ38\"; dkim-atps=neutral","sourceware.org; auth=none"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xy48s3FZ9z9s7c\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 21 Sep 2017 01:55:57 +1000 (AEST)","(qmail 31906 invoked by alias); 20 Sep 2017 15:55:48 -0000","(qmail 31879 invoked by uid 89); 20 Sep 2017 15:55:47 -0000","from mail-wm0-f54.google.com (HELO mail-wm0-f54.google.com)\n\t(74.125.82.54) by sourceware.org\n\t(qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tWed, 20 Sep 2017 15:55:46 +0000","by mail-wm0-f54.google.com with SMTP id a137so5507313wma.0 for\n\t<gcc-patches@gcc.gnu.org>; Wed, 20 Sep 2017 08:55:46 -0700 (PDT)","by 10.80.143.34 with HTTP; Wed, 20 Sep 2017 08:55:43 -0700 (PDT)"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:mime-version:in-reply-to:references:from:date:message-id\n\t:subject:to:content-type; q=dns; s=default; b=OP65CtCh/UZhFet8wP\n\tOul8sAxnWXILbME/Ahy2IQxQ6HyXv97L/7j8PBn15XJA9GA3IzHAZ6Vct2pgrO+P\n\t/img1kCQpZ8nX8ovD8wjC+uWwOIAEsw+XAZHXXuc6A3bWS+BO9Sq475hp1nNiyUG\n\twW7i0X+BNuVVrMdS53S3ZCz6A=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:mime-version:in-reply-to:references:from:date:message-id\n\t:subject:to:content-type; s=default; bh=N5BZbjLbkz3uTrSdDjZN0crj\n\tCjc=; b=tPA5aZ380qapPXEMChtjcsr3z7CRM0jKGEJFAvApSJpgJtuHc1EjcJmb\n\tfsPKV6PmboCDNFOueHM9tgXrerzx+ihCLp1WyzwfZO6EqJPvX2/lbBXtlWU1zmgt\n\tw/qh5S1fJmh9fggjBZpExWud3ZWTxjGPXGhNWvVe/143/dVaods=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-10.5 required=5.0 tests=AWL, BAYES_00,\n\tFREEMAIL_FROM, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE,\n\tRCVD_IN_SORBS_SPAM,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=","X-HELO":"mail-wm0-f54.google.com","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net;\n\ts=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to;\n\tbh=AOfa6fKuoiJ14/KeRKF6G5p2hiYs3yCSUUQHHLExrIw=;\n\tb=GgTIAwZnQ6yA541FcDWH26tp50rKMMFEPxk98ttSUwsLeNQJF8IEpKpfOaV4bXLIP4\n\tv4Yyt0noi5UQlWf/BZvK3J3NyqnLF+LmQzdLqYmTMmBJ+RQ6vLyznPMqR0uLuQF8r75/\n\tHP+q39wo1Ji05yvomLh7vIuRNAU5FC1MoPb04lXfTSonZkt6AaRpOHHt8+TOFQSHwBtZ\n\tGOr3jKLkFslmw8Edte58PgJP0jqviyuVn45GgWfkq2wgeZBKaT8/mYSYSMUImgLxricX\n\t5E0jK+0tkFCWS/BfCUkcLTNdgFe1E37mTu+vGJCgUbjikaoMZ2JgQN4n7zaKo+uoe82z\n\tkEuQ==","X-Gm-Message-State":"AHPjjUjxMoAO+Y5sGJ3xY+TW1yPkqcu7yIFpQWHlEmdZgu6kyE7SQBqo\trZunkrynV3vkpagPWHZEiXwBhZcak8f6SYt+GjYVOw==","X-Google-Smtp-Source":"AOwi7QCd3uk8Y4CwETj/RUS2ukrHZaEbC6bWPlaY1KhnF2eOolt+32J4vZtOTynUBcLngXs8a1pK9UUm2g2R/HJC2cc=","X-Received":"by 10.80.194.217 with SMTP id u25mr4889659edf.260.1505922944288;\n\tWed, 20 Sep 2017 08:55:44 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<87r2v11sht.fsf@linaro.org>","References":"<87r2v11sht.fsf@linaro.org>","From":"Richard Biener <richard.guenther@gmail.com>","Date":"Wed, 20 Sep 2017 17:55:43 +0200","Message-ID":"<CAFiYyc3Yis6b1_BEnPNnXcdADsY0kCKW7Mz1D0C_BUJ_ZMQ6HQ@mail.gmail.com>","Subject":"Re: Add missing int_cst_rangeN checks to tree-vrp.c","To":"GCC Patches <gcc-patches@gcc.gnu.org>,\n\tRichard Sandiford <richard.sandiford@linaro.org>","Content-Type":"text/plain; charset=\"UTF-8\"","X-IsSubscribed":"yes"}}]