{"id":816173,"url":"http://patchwork.ozlabs.org/api/1.2/patches/816173/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/87r2v11sht.fsf@linaro.org/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/1.2/projects/17/?format=json","name":"GNU Compiler Collection","link_name":"gcc","list_id":"gcc-patches.gcc.gnu.org","list_email":"gcc-patches@gcc.gnu.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<87r2v11sht.fsf@linaro.org>","list_archive_url":null,"date":"2017-09-20T12:09:34","name":"Add missing int_cst_rangeN checks to tree-vrp.c","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"2b0646c092b4d62899160d91c93f49e0d5b3a63e","submitter":{"id":5450,"url":"http://patchwork.ozlabs.org/api/1.2/people/5450/?format=json","name":"Richard Sandiford","email":"richard.sandiford@linaro.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/87r2v11sht.fsf@linaro.org/mbox/","series":[{"id":4095,"url":"http://patchwork.ozlabs.org/api/1.2/series/4095/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=4095","date":"2017-09-20T12:09:34","name":"Add missing int_cst_rangeN checks to tree-vrp.c","version":1,"mbox":"http://patchwork.ozlabs.org/series/4095/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/816173/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/816173/checks/","tags":{},"related":[],"headers":{"Return-Path":"<gcc-patches-return-462577-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-462577-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=\"Ppn2WY1j\"; 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 3xxz7z3Q9Lz9t2Q\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 20 Sep 2017 22:09:51 +1000 (AEST)","(qmail 43710 invoked by alias); 20 Sep 2017 12:09:42 -0000","(qmail 43698 invoked by uid 89); 20 Sep 2017 12:09:41 -0000","from mail-wm0-f45.google.com (HELO mail-wm0-f45.google.com)\n\t(74.125.82.45) by sourceware.org\n\t(qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tWed, 20 Sep 2017 12:09:40 +0000","by mail-wm0-f45.google.com with SMTP id i189so6586665wmf.1 for\n\t<gcc-patches@gcc.gnu.org>; Wed, 20 Sep 2017 05:09:39 -0700 (PDT)","from localhost (92.40.248.127.threembb.co.uk. [92.40.248.127]) by\n\tsmtp.gmail.com with ESMTPSA id\n\tj6sm583279wmg.28.2017.09.20.05.09.36 for\n\t<gcc-patches@gcc.gnu.org> (version=TLS1_2\n\tcipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tWed, 20 Sep 2017 05:09:36 -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:from\n\t:to:subject:date:message-id:mime-version:content-type; q=dns; s=\n\tdefault; b=UvyPEKcunbBXhKcbkRr9l3QtKxRZi/8fqpb6gK8YfSz0O5S4IOFE0\n\t5u9biasC8Nb6hf2qX3pEsQoPWDeHBKGX3DYV5XkJOiltocJxmP0jtlJ4WRGVBizp\n\t4xstLAm2u7vvaVR6sTi6Acx2kxfRDMfM3Hf15gz+LivlGlbXTCiZXk=","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:from\n\t:to:subject:date:message-id:mime-version:content-type; s=\n\tdefault; bh=sfDnUYiTtJHYsLNqSDMjTlUpLDM=; b=Ppn2WY1jIhFtdb4O+xky\n\tiRmfffBokSRTB7hoN8IzZUM7FpEZxRg32VQ0ORMFOl7xs+qaZZ3P7y0gY9I1dVeD\n\ty6vQ3ftSMLbbZRCAo8UMniAZb/9H5hyPuf83BzW5WJHQ/OkJQyWzQaZx49pntJON\n\twYgVbipl3W5GqwvkqiIEBwY=","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=-11.7 required=5.0 tests=AWL, BAYES_00,\n\tGIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=wi","X-HELO":"mail-wm0-f45.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:from:to:mail-followup-to:subject:date:message-id\n\t:user-agent:mime-version;\n\tbh=FaB2gFKyfqas71p2A+JZAxPWjyBEiRq3BeCqefyx9Qo=;\n\tb=kwbUKbgCq+Y1EoW7ktFGItQ43YIWtLxvpBwBqHvBqs1WuCpVzbdldjbyopAoWLTE80\n\tHVISMSomznauU2EMWnKx/0tZityo/8R9A2iEe2YnwrS6wDgb80yxkuC7pWy0LF8LrwR7\n\tXiTEmISbobP7uSHtMNZd5Qs3lArpDnr8PWsSwLxj9CPYMqFbFOrzpkDk29HvxYwu67Jo\n\tx0qDHZm2sOpH9R27l3FSGC14s2zsHVrGvKQS8eb9EMAJvg/qXls7I6U3bVXr8m6mpgfo\n\trfG9Jz0qc2wPv1IiCHoBgqCy4+f+MIqwo9L8LvtVUTemuE02Jrjaqx/g1w2oFAUUl9+X\n\teq/Q==","X-Gm-Message-State":"AHPjjUiDYuBAfacz0INC7kZnNs6ODTVaYwzFPbl8MUbn8qndRRX5tnRL\tCTqQfXhgzjflIxNBmOe/T8TTdACk9tw=","X-Google-Smtp-Source":"AOwi7QCs95dkzM0p4VjzPfEVvVJOuYuYnt2TCUgK8KBCYtzrSCm+kjRqxqejAEaAOjNN+bbxGzmtbw==","X-Received":"by 10.28.70.130 with SMTP id t124mr3654358wma.145.1505909377486;\n\tWed, 20 Sep 2017 05:09:37 -0700 (PDT)","From":"Richard Sandiford <richard.sandiford@linaro.org>","To":"gcc-patches@gcc.gnu.org","Mail-Followup-To":"gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org","Subject":"Add missing int_cst_rangeN checks to tree-vrp.c","Date":"Wed, 20 Sep 2017 13:09:34 +0100","Message-ID":"<87r2v11sht.fsf@linaro.org>","User-Agent":"Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)","MIME-Version":"1.0","Content-Type":"text/plain"},"content":"The BIT_AND_EXPR handling in extract_range_from_binary_expr_1\nwas using value_range_constant_singleton without first checking\nwhether the range was a constant.  The earlier handling was correctly\nguarded:\n\n\t  /* If either input range contains only non-negative values\n\t     we can truncate the result range maximum to the respective\n\t     maximum of the input range.  */\n\t  if (int_cst_range0 && tree_int_cst_sgn (vr0.min) >= 0)\n\t    wmax = wi::min (wmax, vr0.max, TYPE_SIGN (expr_type));\n\t  if (int_cst_range1 && tree_int_cst_sgn (vr1.min) >= 0)\n\t    wmax = wi::min (wmax, vr1.max, TYPE_SIGN (expr_type));\n\nso this patch uses the same guards again.\n\nExisting tests showed the need for this once polynomial constants\nare added.\n\nTested on aarch64-linux-gnu, x86_64-linux-gnu and powerpc64le-linus-gnu.\nOK to install?\n\nRichard\n\n\n2017-09-20  Richard Sandiford  <richard.sandiford@linaro.org>\n\t    Alan Hayward  <alan.hayward@arm.com>\n\t    David Sherwood  <david.sherwood@arm.com>\n\ngcc/\n\t* tree-vrp.c (extract_range_from_binary_expr_1): Check\n\tint_cst_rangeN before calling value_range_constant_singleton (&vrN).","diff":"Index: gcc/tree-vrp.c\n===================================================================\n--- gcc/tree-vrp.c\t2017-09-20 13:04:29.932873038 +0100\n+++ gcc/tree-vrp.c\t2017-09-20 13:07:32.589667751 +0100\n@@ -2930,9 +2930,11 @@ extract_range_from_binary_expr_1 (value_\n \t\t= wi::set_bit_in_zero (TYPE_PRECISION (expr_type) - 1,\n \t\t\t\t       TYPE_PRECISION (expr_type));\n \t      if (!TYPE_UNSIGNED (expr_type)\n-\t\t  && ((value_range_constant_singleton (&vr0)\n+\t\t  && ((int_cst_range0\n+\t\t       && value_range_constant_singleton (&vr0)\n \t\t       && !wi::cmps (vr0.min, sign_bit))\n-\t\t      || (value_range_constant_singleton (&vr1)\n+\t\t      || (int_cst_range1\n+\t\t\t  && value_range_constant_singleton (&vr1)\n \t\t\t  && !wi::cmps (vr1.min, sign_bit))))\n \t\t{\n \t\t  min = TYPE_MIN_VALUE (expr_type);\n","prefixes":[]}