On Thu, Jan 31, 2019 at 4:36 PM Jakub Jelinek <ja...@redhat.com> wrote:
>
> On Thu, Jan 31, 2019 at 04:05:51PM +0100, Richard Biener wrote:
> > > On Thu, Jan 31, 2019 at 03:56:12PM +0100, Richard Biener wrote:
> > > > Don't you alreday have
> > > >
> > > > @@ -4200,10 +4202,34 @@ pass_sprintf_length::execute (function *fun)
> > > >    init_target_to_host_charmap ();
> > > >
> > > >    calculate_dominance_info (CDI_DOMINATORS);
> > > > +  bool optimizing_late = optimize > 0 && fold_return_value;
> > > > +  if (optimizing_late)
> > > > +    {
> > > > +      /* ?? We should avoid changing the CFG as much as possible.
> > > > ...
> > > > +      loop_optimizer_init (LOOPS_HAVE_PREHEADERS);
> > > > +      scev_initialize ();
> > > > +    }
> > > >
> > > > so loops are only initialized if fold_return_value is true?  Ah - but 
> > > > that's
> > > > the pass parameter from params.def rather than the flag to enable
> > > > the folding...  So indeed, change it to include && 
> > > > flag_printf_return_value
> > >
> > > fold_return_value is not the same thing as flag_printf_return_value,
> > > the former is just a bool whether it is the -O0 or -O1+ version of the 
> > > pass.
> > > So, optimizing_late doesn't make much sense, one can use optimize > 0
> > > directly instead.
> > >
> > > If changing the above to && flag_printf_return_value then people will
> > > complain that they get the false positive warning with -Wall
> > > -fno-printf-return-value.
> >
> > Sure - too bad then.  Another option would be to make SCEV / niter analysis
> > "safe" to be called with LOOPS_AVOID_CFG_MANIPULATIONs (multiple
> > latches, multiple entries into headers, etc.).
>
> But then that isn't likely going to make it into GCC9.
>
> Do we care that much about -W* not affecting code generation when we have
> many -W* options that do affect it and aren't going to be fixed in GCC9 (and
> unlikely later on either - mainly the C++ caching related ones), plus
> it could affect code generation only if one uses -fno-printf-return-value
> explicitly?

We definitely shouldn't willingly add new instances.  Why do we care
about people getting false positives when they willingly disable
-fprintf-return-value?

Richard.

>         Jakub

Reply via email to