From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 83025 invoked by alias); 25 Apr 2019 11:27:48 -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 83017 invoked by uid 89); 25 Apr 2019 11:27:48 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-7.1 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=UD:C.jj X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 25 Apr 2019 11:27:47 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 667EE3003B53; Thu, 25 Apr 2019 11:27:46 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.40.205.45]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0C0821800B; Thu, 25 Apr 2019 11:27:45 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id x3PBRhEd007967; Thu, 25 Apr 2019 13:27:43 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id x3PBRemO007966; Thu, 25 Apr 2019 13:27:40 +0200 Date: Thu, 25 Apr 2019 11:36:00 -0000 From: Jakub Jelinek To: Richard Biener , Rainer Orth Cc: gcc-patches@gcc.gnu.org, jason@redhat.com Subject: [PATCH] Fix -Wunused-var-35.C (was Re: [PATCH][C++] Improve compile-time by ordering expensive checks last) Message-ID: <20190425112739.GJ21066@tucnak> Reply-To: Jakub Jelinek References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.3 (2019-02-01) X-IsSubscribed: yes X-SW-Source: 2019-04/txt/msg00977.txt.bz2 On Thu, Apr 25, 2019 at 01:09:00PM +0200, Rainer Orth wrote: > > cp/ > > * call.c (null_ptr_cst_p): Order checks according to expensiveness. > > (conversion_null_warnings): Likewise. > > * typeck.c (same_type_ignoring_top_level_qualifiers_p): Return > > early if type1 == type2. > > this patch caused > > +XPASS: g++.dg/warn/Wunused-var-35.C -std=gnu++98 bug (test for warnings, line 14) > > First seen on i386-pc-solaris2.11 and sparc-sun-solaris2.11, according > to gcc-testresults everywhere. Confirmed by reverting the patch locally > and re-testing the affected testcase. I can reproduce that too, seems to be the @@ -6896,8 +6897,8 @@ } /* Handle zero as null pointer warnings for cases other than EQ_EXPR and NE_EXPR */ - else if (null_ptr_cst_p (expr) && - (TYPE_PTR_OR_PTRMEM_P (totype) || NULLPTR_TYPE_P (totype))) + else if ((TYPE_PTR_OR_PTRMEM_P (totype) || NULLPTR_TYPE_P (totype)) + && null_ptr_cst_p (expr)) { location_t loc = get_location_for_expr_unwinding_for_system_header (expr); maybe_warn_zero_as_null_pointer_constant (expr, loc); hunk. The Wunused-var-35.C patch hasn't been posted to gcc-patches, but judging from the corresponding PR, I'd say the right thing is below. Regtested on x86_64-linux and i686-linux, ok for trunk? 2019-04-25 Jakub Jelinek PR c++/44648 * g++.dg/warn/Wunused-var-35.C: Remove xfail. --- gcc/testsuite/g++.dg/warn/Wunused-var-35.C.jj 2019-02-04 09:44:31.365413407 +0100 +++ gcc/testsuite/g++.dg/warn/Wunused-var-35.C 2019-04-25 13:24:49.717065815 +0200 @@ -11,9 +11,8 @@ int main() else return 1; - if (const bool b2 = 1) // { dg-warning "\\\[-Wunused-variable\\\]" "bug" { xfail c++98_only } } + if (const bool b2 = 1) // { dg-warning "\\\[-Wunused-variable\\\]" } return 0; else return 1; } - Jakub