From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8832 invoked by alias); 25 Apr 2017 09:54:45 -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 8655 invoked by uid 89); 25 Apr 2017 09:54:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=management, policy X-HELO: mail-oi0-f68.google.com Received: from mail-oi0-f68.google.com (HELO mail-oi0-f68.google.com) (209.85.218.68) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 25 Apr 2017 09:54:37 +0000 Received: by mail-oi0-f68.google.com with SMTP id a3so28958969oii.3 for ; Tue, 25 Apr 2017 02:54:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=eJutiW3AdveQYgBkuuGP+JGYY9YBa45iNpwAThpjl1Q=; b=p9kctUCDPlTDIvqyf8aecJoSB42PJfnGyp1bLmvt6r2zcMKAqBSYUdB8I5tZhEiqWX RprdsZd6cGDyw+Oo7nF3mHIb5QAhsubSRx9KZ0S+ReK+wx0GEOaO65TU0kQoau6Alv05 mX27m9uImpYtVT2piKdeJsXPn8GSRqkEBtUy/mQkLaxM4mvWqrfUeQYhfdwJNZuNGyIk HTpCXNzzmIDxBbW2/ctMdsnC5AztyKY6bJBdph78HKgFVOYBjCX0eJ3HYISFqqXt/Uct 1ZAVkvfa6ur9+rA439/td/ouCFba6EDgnsBuGcT4n5Eejkvy8o87Q6OTI6beo/FMVi8C 30Zg== X-Gm-Message-State: AN3rC/7kx+3rwwrsATmiLpoLUczlHMJ2WpGGC8k2JZbrOkuUxpcnyP7A /I4mqoqot9zE3HlABzXierVbexNJ1w== X-Received: by 10.202.197.194 with SMTP id v185mr14813176oif.123.1493114077776; Tue, 25 Apr 2017 02:54:37 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.26.34 with HTTP; Tue, 25 Apr 2017 02:54:37 -0700 (PDT) In-Reply-To: References: From: Richard Biener Date: Tue, 25 Apr 2017 10:03:00 -0000 Message-ID: Subject: Re: [PATCH] squash spurious warnings in dominance.c To: Martin Sebor Cc: Gcc Patch List Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2017-04/txt/msg01140.txt.bz2 On Mon, Apr 24, 2017 at 11:07 PM, Martin Sebor wrote: > On 04/24/2017 01:32 AM, Richard Biener wrote: >> >> On Sat, Apr 22, 2017 at 2:51 AM, Martin Sebor wrote: >>> >>> Bug 80486 - spurious -Walloc-size-larger-than and >>> -Wstringop-overflow in dominance.c during profiledbootstrap >>> points out a number of warnings that show up in dominance.c >>> during a profiledbootstrap. I'm pretty sure the warnings >>> are due to the size check the C++ new expression introduces >>> to avoid unsigned overflow before calling operator new, and >>> by some optimization like jump threading introducing a branch >>> with the call to the allocation function and memset with >>> the excessive constant size. >>> >>> Two ways to avoid it come to mind: 1) use the libiberty >>> XCNEWVEC and XNEWVEC macros instead of C++ new expressions, >>> and 2) constraining the size variable to a valid range. >>> >>> Either of these approaches should result in better code than >>> the new expression because they both eliminate the test for >>> the overflow. Attached is a patch that implements (1). I >>> chose it mainly because it seems in line with GCC's memory >>> management policy and with avoiding exceptions. >>> >>> An alternate patch should be straightforward. Either add >>> an assert like the one below or change the type of >>> m_n_basic_blocks from size_t to unsigned. This approach, >>> though less intrusive, will likely bring the warning back >>> in ILP32 builds; I'm not sure if it matters. >> >> >> Please change m_n_basic_blocks (and local copies) from size_t >> to unsigned int. This is an odd inconsistency that's worth fixing >> in any case. > > > Attached is this version of the patch. It also eliminates > the warnings and passes profiledbootstrap/regression test > on x86_64. Ok. Thanks, Richard. > Martin >