From patchwork Thu Nov 24 17:41:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prathamesh Kulkarni X-Patchwork-Id: 83977 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp191964qgi; Thu, 24 Nov 2016 09:41:52 -0800 (PST) X-Received: by 10.84.204.8 with SMTP id a8mr7906708ple.172.1480009312851; Thu, 24 Nov 2016 09:41:52 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id r12si40344099pfg.7.2016.11.24.09.41.52 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Nov 2016 09:41:52 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-442588-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; spf=pass (google.com: domain of gcc-patches-return-442588-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-442588-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=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 :mime-version:from:date:message-id:subject:to:content-type; q= dns; s=default; b=EODnTRrIZVdhDP8kfi0hL/qMtd/eEtpoC44HmcIFSCm2+/ QtLL4Z3so9HYpYMJwYY7awpGQZANRu7n57nNX/q4EGTirupq9OPJbmUJQXd6VPLR TqHmEtQHWudLqVMogbonVqb8PyvJjFqTr0VyMO9TAwS2dRHP7QNsapWrvgEvk= 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 :mime-version:from:date:message-id:subject:to:content-type; s= default; bh=F1Jg6BmIt+z2ijIY4LuMFq6y29Y=; b=AnFUpOLGaA32Oi5N5qgA nl1qxQacfjTipECpQCv/UwdmTG8gldvjyY1q8sl5SgGyCnnZRgTN0cLNnIxZUMWE kTGC9DCM2lNwwqH10vKBCGsOiGT0vMfdbOz9gUWX+DdqiafharSdyYbdDZyKP1Tw v87/qjsh3IuTxwuGvQeAGGM= Received: (qmail 46275 invoked by alias); 24 Nov 2016 17:41:38 -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 46223 invoked by uid 89); 24 Nov 2016 17:41:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=no version=3.3.2 spammy= X-HELO: mail-io0-f179.google.com Received: from mail-io0-f179.google.com (HELO mail-io0-f179.google.com) (209.85.223.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 24 Nov 2016 17:41:28 +0000 Received: by mail-io0-f179.google.com with SMTP id x94so89448952ioi.3 for ; Thu, 24 Nov 2016 09:41:28 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=CDNUbRRfCqY3SbMOWOsHLl1qH/59W3mwwVGWvR5mXEA=; b=ETlAnNcIxjwO8QijfO0Uscg+s/v/mLOYZG9ysdpUDIUpJR8S7keOqlKXbTTWD7hSyF XSXLq2LY48JGRxuNQKo1auocTux6dzRPkAcyG5uoRXF9b19kK8JwPYzMAXHjUn2cOzz0 Djifg8AYSH5WVo+e3LBhNS7D0U6vqN7ljkCrqHBBdFzpLjokVxjOxJ7nHzTsIXqIBgGz MvW0w+Cc95PWkMsc4IxXnNF/UpJ5QSvqUjM6EsUxkNwmfL7dLcZqg1z0AvY2Qsl/NN5Z j2pRTp06bjuND4FqH+ijSnugGBrfqbJUcNaVafWiXbm2enS/zWGfStuo6/0uojk2haud Q12Q== X-Gm-Message-State: AKaTC00mJ2bBs0KzI2TCaBG/GHSx+BEV4YlB6rPQuZfQoBo6RkkVJST3EhwSxqo30PmHUF8B5Y4wbMpSmtTefJuX X-Received: by 10.107.3.168 with SMTP id e40mr2982573ioi.89.1480009286818; Thu, 24 Nov 2016 09:41:26 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.136.156 with HTTP; Thu, 24 Nov 2016 09:41:26 -0800 (PST) From: Prathamesh Kulkarni Date: Thu, 24 Nov 2016 23:11:26 +0530 Message-ID: Subject: PR78501 To: gcc Patches , Jakub Jelinek , Richard Biener X-IsSubscribed: yes Hi, The attached patch fixes ada bootstrap failure. Bootstrap+tested on x86_64-unknown-linux-gnu with --enable-languages=all,ada Cross-tested on aarch64*-*-*, arm*-*-* with --enable-languages=c,c++,fortran. OK to commit ? Thanks, Prathamesh 2016-11-24 Jakub Jelinek Prathamesh Kulkarni PR middle-end/78501 * tree-vrp.c (extract_range_basic): Check for ptrdiff_type_node to be non null and it's precision matches precision of lhs's type. diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 33e0a75..8bea4db 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -4028,15 +4028,20 @@ extract_range_basic (value_range *vr, gimple *stmt) } return; case CFN_BUILT_IN_STRLEN: - { - tree type = TREE_TYPE (gimple_call_lhs (stmt)); - tree max = vrp_val_max (ptrdiff_type_node); - wide_int wmax = wi::to_wide (max, TYPE_PRECISION (TREE_TYPE (max))); - tree range_min = build_zero_cst (type); - tree range_max = wide_int_to_tree (type, wmax - 1); - set_value_range (vr, VR_RANGE, range_min, range_max, NULL); - } - return; + if (tree lhs = gimple_call_lhs (stmt)) + if (ptrdiff_type_node + && (TYPE_PRECISION (ptrdiff_type_node) + == TYPE_PRECISION (TREE_TYPE (lhs)))) + { + tree type = TREE_TYPE (lhs); + tree max = vrp_val_max (ptrdiff_type_node); + wide_int wmax = wi::to_wide (max, TYPE_PRECISION (TREE_TYPE (max))); + tree range_min = build_zero_cst (type); + tree range_max = wide_int_to_tree (type, wmax - 1); + set_value_range (vr, VR_RANGE, range_min, range_max, NULL); + return; + } + break; default: break; }