{"id":816171,"url":"http://patchwork.ozlabs.org/api/1.2/patches/816171/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/87vakd1sn3.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":"<87vakd1sn3.fsf@linaro.org>","list_archive_url":null,"date":"2017-09-20T12:06:24","name":"range_int_cst_p handling in extract_range_from_binary_expr_1","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"b297d217b467a9902a187bc50be1147099ddeeba","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/87vakd1sn3.fsf@linaro.org/mbox/","series":[{"id":4093,"url":"http://patchwork.ozlabs.org/api/1.2/series/4093/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=4093","date":"2017-09-20T12:06:24","name":"range_int_cst_p handling in extract_range_from_binary_expr_1","version":1,"mbox":"http://patchwork.ozlabs.org/series/4093/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/816171/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/816171/checks/","tags":{},"related":[],"headers":{"Return-Path":"<gcc-patches-return-462575-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-462575-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=\"PiLXJjEe\"; 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 3xxz4P5vfQz9t2Q\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 20 Sep 2017 22:06:41 +1000 (AEST)","(qmail 114305 invoked by alias); 20 Sep 2017 12:06:33 -0000","(qmail 113960 invoked by uid 89); 20 Sep 2017 12:06:32 -0000","from mail-wr0-f171.google.com (HELO mail-wr0-f171.google.com)\n\t(209.85.128.171) by sourceware.org\n\t(qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tWed, 20 Sep 2017 12:06:30 +0000","by mail-wr0-f171.google.com with SMTP id u96so1974615wrb.6 for\n\t<gcc-patches@gcc.gnu.org>; Wed, 20 Sep 2017 05:06:30 -0700 (PDT)","from localhost (92.40.248.127.threembb.co.uk. [92.40.248.127]) by\n\tsmtp.gmail.com with ESMTPSA id\n\tf140sm1531798wmd.12.2017.09.20.05.06.26 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:06:27 -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=eZ18adXKAkEWsaFjp1GzT+aQIYmrLd1qIxFmpkb7y5LfE/ya3vgQX\n\tK9V3V5w/VBXrs6BnNjcAgHYFOeb8QJSasNwQPi/c42LI+FuvMnJClUpdrltlB/Y2\n\tOnxx5GtYTEp6tb5zUdlEBPaJXqDHQrgle0M6AnsfmSjsiXIrqce8G8=","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=8ZIPdR4g1ipMKPhpjQXjFIR4pGU=; b=PiLXJjEecfr9NAefrY8F\n\tbTzJxhnLO4MWyDzcnzM0W25sqqYm1lz8XQPGk7AhrmbAGaUp5GCZPvaVJJE204zi\n\tRZHHLefzXvVLJJuqIlA1DVMCK9dwoqEvQKjzzbG52C4MnxDyVTnwy5K7QPX7tUtX\n\tU/SSiASQYVgbp6EA2dvNyzM=","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.3 required=5.0 tests=AWL, BAYES_00,\n\tGIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE,\n\tRCVD_IN_SORBS_SPAM,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=20170830,\n\tsk:davids, H*r:threembb.co.uk, sk:david.s","X-HELO":"mail-wr0-f171.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=vSTn8IueWatcb+PyypuchG5I4k9d9NKaL9kFPlmS8t4=;\n\tb=pgmPGjIX+wgEm3EBSjU6jy9I3ncFMj8uPl9gK83A6sXkvDzp83LNqdwQiJxa+xD3RS\n\twWyo2WgSKXzsaqw0jIgti0BMzrcPalwWgsS3iOuXWo/4iV+vaeBHCS9abXoVIu6epIDB\n\tImrHUAiaSOsYrrW4zF34FLWGa6yGbCf+ogQJBO4jps3S2+Ywnyo/LXQZWV7P2JxKbyFS\n\twszQrPeAsMWy3oy36Mch+Xa9VXEzyLydG/Fnd5TXOZc5qKgK5dKbbNleYI8Z5BZDDOrJ\n\tgpwaGWA4MdgnO98XY6Cv8zwNENn/1qkE6xGOoo/wLiJET1AhdRznDvnHEOPBcuLlN4s0\n\t3m9A==","X-Gm-Message-State":"AHPjjUgMfy2wuJXFX1iBY0l6JIfFeqdca45VqpAgyD4NoSKgkWnh3cnI\t+dSIQY2ES2xmLVejbtsUUFEUvH0kZxs=","X-Google-Smtp-Source":"AOwi7QAxG78pghH1XFlXKES1pnVFXS5PjKd11UAH1zAfFSBjsQgmLeAhmS4YdBd5utJ35oyyK9Xaag==","X-Received":"by 10.223.130.77 with SMTP id 71mr3927107wrb.247.1505909188111;\n\tWed, 20 Sep 2017 05:06:28 -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":"range_int_cst_p handling in extract_range_from_binary_expr_1","Date":"Wed, 20 Sep 2017 13:06:24 +0100","Message-ID":"<87vakd1sn3.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":"extract_range_from_binary_expr_1 had:\n\n      if (range_int_cst_p (&vr0)\n          && range_int_cst_p (&vr1)\n          && TYPE_OVERFLOW_WRAPS (expr_type))\n        ...\n      ...\n      extract_range_from_multiplicative_op_1 (vr, code, &vr0, &vr1);\n\nbut extract_range_from_multiplicative_op_1 also requires range_int_cst_p.\nI think we should bail out if either range isn't a constant.\n\nThis might only be theoretical with current sources, but it's needed\nonce polynomial constants are 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): Don't call\n\textract_range_from_multiplicative_op_1 if !range_int_cst_p.","diff":"Index: gcc/tree-vrp.c\n===================================================================\n--- gcc/tree-vrp.c\t2017-08-30 12:18:46.631541422 +0100\n+++ gcc/tree-vrp.c\t2017-09-20 13:04:20.397027078 +0100\n@@ -2462,9 +2462,14 @@ extract_range_from_binary_expr_1 (value_\n       signop sign = TYPE_SIGN (expr_type);\n       unsigned int prec = TYPE_PRECISION (expr_type);\n \n-      if (range_int_cst_p (&vr0)\n-\t  && range_int_cst_p (&vr1)\n-\t  && TYPE_OVERFLOW_WRAPS (expr_type))\n+      if (!range_int_cst_p (&vr0)\n+\t  || !range_int_cst_p (&vr1))\n+\t{\n+\t  set_value_range_to_varying (vr);\n+\t  return;\n+\t}\n+\n+      if (TYPE_OVERFLOW_WRAPS (expr_type))\n \t{\n \t  typedef FIXED_WIDE_INT (WIDE_INT_MAX_PRECISION * 2) vrp_int;\n \t  typedef generic_wide_int\n","prefixes":[]}