From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 83763 invoked by alias); 28 Aug 2018 10:41:09 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 83753 invoked by uid 89); 28 Aug 2018 10:41:08 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.8 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1502 X-HELO: mail-lj1-f170.google.com Received: from mail-lj1-f170.google.com (HELO mail-lj1-f170.google.com) (209.85.208.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 28 Aug 2018 10:41:07 +0000 Received: by mail-lj1-f170.google.com with SMTP id 203-v6so962858ljj.13 for ; Tue, 28 Aug 2018 03:41:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=DJf4mVVIKXdElk/WanL18wKS1W9ufw7LuGP4hGBsUsI=; b=tZRImTyR+BgBuuWMNrCb/ij0+RwW81gqM6zdxvpJ89NrlamGlwd6vykf9eBAX6ZEe+ 5auXZ/PALQRUEdUNyV8vdLWRmmuCZnlH53tSGeaYOJfa9Vi7TTTDh/1SlJeGfi+SJnLU I2qHh0EQ3iTL3sskv9WwBTk81jFsDEF+N+hr/RPj3g1Ugz4MuImUQYmMQORbCS+1L90O LOPJc8RoyAD2JMq5gZ6Ijojf7j+aO4EdOw4Q6BhJmGaGjs+i44NeRBB0Eijo8ANhwdhO 2amnrRCLgbrRvQBanRvvmUVaHLygiINVCzPr4TTlAiMtLgq3cIHU6ghDZngfEyLGEzCS kIIA== MIME-Version: 1.0 References: <871saisrkv.fsf@arm.com> In-Reply-To: <871saisrkv.fsf@arm.com> From: Richard Biener Date: Tue, 28 Aug 2018 10:41:00 -0000 Message-ID: Subject: Re: Fix unguarded use of tree_to_shwi in tree-ssa-sccvn.c To: GCC Patches , Richard Sandiford Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2018-08/txt/msg01747.txt.bz2 On Tue, Aug 28, 2018 at 12:39 PM Richard Sandiford wrote: > > Fixes many testsuite failures for SVE. > > Tested on aarch64-linux-gnu (with and without SVE), aarch64_be-elf > and x86_64-linux-gnu. OK to install? OK. Richard. > Richard > > > 2018-08-28 Richard Sandiford > > gcc/ > * tree-ssa-sccvn.c (fully_constant_vn_reference_p): Fix unguarded > use of tree_to_shwi. Remove duplicated test for the size being > a whole number of bytes. > > Index: gcc/tree-ssa-sccvn.c > =================================================================== > --- gcc/tree-ssa-sccvn.c 2018-08-28 11:38:22.000000000 +0100 > +++ gcc/tree-ssa-sccvn.c 2018-08-28 11:38:22.676512354 +0100 > @@ -1409,16 +1409,16 @@ fully_constant_vn_reference_p (vn_refere > /* Simplify reads from constants or constant initializers. */ > else if (BITS_PER_UNIT == 8 > && COMPLETE_TYPE_P (ref->type) > - && is_gimple_reg_type (ref->type) > - && (!INTEGRAL_TYPE_P (ref->type) > - || TYPE_PRECISION (ref->type) % BITS_PER_UNIT == 0)) > + && is_gimple_reg_type (ref->type)) > { > poly_int64 off = 0; > HOST_WIDE_INT size; > if (INTEGRAL_TYPE_P (ref->type)) > size = TYPE_PRECISION (ref->type); > - else > + else if (tree_fits_shwi_p (TYPE_SIZE (ref->type))) > size = tree_to_shwi (TYPE_SIZE (ref->type)); > + else > + return NULL_TREE; > if (size % BITS_PER_UNIT != 0 > || size > MAX_BITSIZE_MODE_ANY_MODE) > return NULL_TREE;