> gcc/ChangeLog:
> 
> 2020-01-15  Martin Liska  <mli...@suse.cz>
> 
>       * ipa-profile.c (ipa_profile_read_edge_summary): Do not allow
>       2 calls of streamer_read_hwi in a function call.

Good catch, Martin!
> ---
>  gcc/ipa-profile.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/gcc/ipa-profile.c b/gcc/ipa-profile.c
> index fc231c916b7..03272f20987 100644
> --- a/gcc/ipa-profile.c
> +++ b/gcc/ipa-profile.c
> @@ -451,8 +451,9 @@ ipa_profile_read_edge_summary (class lto_input_block *ib, 
> cgraph_edge *edge)
>  
>    for (i = 0; i < len; i++)
>    {
> -    speculative_call_target item (streamer_read_hwi (ib),
> -     streamer_read_hwi (ib));
> +    unsigned int target_id = streamer_read_hwi (ib);
> +    int target_probability = streamer_read_hwi (ib);
> +    speculative_call_target item (target_id, target_probability);

David, this may be interesting case for analyzer/warning. This surfaced
in LTO stremaing for second time quite recently and leads to hard to
find bugs. 

While day before yesterday in pub I argued that warning for nested
function calls is not a good way since it would warn too often, perhaps
we want to have some way to annotate streamer functions to make it clear
that we do not want them to appear inside function call parameters where
evaluation order is undefined.

Honza
>      csum->speculative_call_targets.safe_push (item);
>    }
>  }
> -- 
> 2.24.1
> 

Reply via email to