On Wed, Nov 14, 2018 at 02:51:45PM +0000, Michael Matz wrote:
> Hi,
> 
> our warning code sometimes adds locations to statement which didn't have 
> them before, which can in turn lead to code changes (here only label 
> numbers change).  It seems better to not do that from warning code, and 
> here it's easy to do: just return the location we want to use for 
> warnings, don't change it in the statement itself.
> 
> Regstrapped on x86-64, okay for trunk?
> 
> 
> Ciao,
> Michael.
> 
>       PR middle-end/86575
>       * gimplify.c (collect_fallthrough_labels): Add new argument,
>       return location via that, don't modify statements.
>       (warn_implicit_fallthrough_r): Adjust call, don't use
>       statement location directly.
> 
> diff --git a/gcc/gimplify.c b/gcc/gimplify.c
> index 509fc2f3f5be..22dff0e546c9 100644
> --- a/gcc/gimplify.c
> +++ b/gcc/gimplify.c
> @@ -1938,10 +1938,12 @@ last_stmt_in_scope (gimple *stmt)
>  
>  static gimple *
>  collect_fallthrough_labels (gimple_stmt_iterator *gsi_p,
> -                         auto_vec <struct label_entry> *labels)
> +                         auto_vec <struct label_entry> *labels,
> +                         location_t *prevloc)
>  {
>    gimple *prev = NULL;

Looks good, thanks, though PREVLOC should probably be described in the comment.

Marek

Reply via email to