[PATCH] Fix -Wunused-var-35.C (was Re: [PATCH][C++] Improve compile-time by ordering expensive checks last)

Jakub Jelinek jakub@redhat.com
Thu Apr 25 11:55:00 GMT 2019


On Thu, Apr 25, 2019 at 01:39:02PM +0200, Richard Biener wrote:
> > Regtested on x86_64-linux and i686-linux, ok for trunk?
> 
> The patch would be obvious but I wonder how the above can change 
> anything...  (but I can reproduce with even only that change)

Haven't stepped through it in a debugger, but I bet it is the
fold_non_dependent_expr call in null_ptr_cst_p which is done for C++98 only.
That will mark it as TREE_USED in the end most likely and the
earlier fix for the PR44648 issues, r249083, was also about not trying to
fold the stuff early.

> > 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



More information about the Gcc-patches mailing list