public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Richard Biener <rguenther@suse.de>,
	       Rainer Orth <ro@cebitec.uni-bielefeld.de>
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)
Date: Thu, 25 Apr 2019 11:36:00 -0000	[thread overview]
Message-ID: <20190425112739.GJ21066@tucnak> (raw)
In-Reply-To: <yddk1fijq9f.fsf@CeBiTec.Uni-Bielefeld.DE>

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  <jakub@redhat.com>

	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

  reply	other threads:[~2019-04-25 11:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-16 12:34 [PATCH][C++] Improve compile-time by ordering expensive checks last Richard Biener
2019-04-17 15:35 ` Richard Biener
2019-04-19  5:32   ` Jason Merrill
2019-04-25 11:27   ` Rainer Orth
2019-04-25 11:36     ` Jakub Jelinek [this message]
2019-04-25 11:48       ` [PATCH] Fix -Wunused-var-35.C (was Re: [PATCH][C++] Improve compile-time by ordering expensive checks last) Richard Biener
2019-04-25 11:55         ` Jakub Jelinek
2019-04-25 12:16           ` Richard Biener
2019-04-25 21:14       ` Jason Merrill

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190425112739.GJ21066@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    --cc=rguenther@suse.de \
    --cc=ro@cebitec.uni-bielefeld.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).