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