On Mon, 28 Sep 2026, Tamar Christina wrote:

> When doing profiledbootstrap the compiler fails with -Wuninitialized
> false positive in stageprofile-bubble
> 
> This is a false positive as the analyzer seems unable to see that if
> is_a <.., &foo> passes that foo will be initialized.
> 
> There didn't seem to be a good "initial" value here that wouldn't be
> confusing so instead I rewrote the check to avoid the out parameter.
> 
> Bootstrapped Regtested on aarch64-none-linux-gnu,
> arm-none-linux-gnueabihf, x86_64-pc-linux-gnu
> -m32, -m64
> 
> with:
> 
>  - default bootstrap
>  - profiledbootstrap
> 
> and no issues.
> 
> Ok for master?
>
> Thanks,
> Tamar
> 
> gcc/ChangeLog:
> 
>       PR bootstrap/127635
>       * simplify-rtx.cc (simplify_context::simplify_subreg): Avoid is_a<..>
>       with ref param.
> 
> ---
> diff --git a/gcc/simplify-rtx.cc b/gcc/simplify-rtx.cc
> index 
> 285826a3fedac7dc95efb27f37b9ef7a7a1ef7e2..7c068814ae7cfa9477bcb370007b05d9649de8a5
>  100644
> --- a/gcc/simplify-rtx.cc
> +++ b/gcc/simplify-rtx.cc
> @@ -8959,10 +8959,15 @@ simplify_context::simplify_subreg (machine_mode 
> outermode, rtx op,
>       break;
>        }
>  
> -  if (is_a <scalar_int_mode> (outermode, &int_outermode)
> -      && is_a <scalar_int_mode> (innermode, &int_innermode)
> -      && known_eq (byte, subreg_lowpart_offset (int_outermode, 
> int_innermode)))
> +  if (SCALAR_INT_MODE_P (outermode)
> +      && SCALAR_INT_MODE_P (innermode)

Can you retain is_a <> here, but in it's single-argument form?

OK with that change unless Richard has a better idea.
Richard.

> +      && known_eq (byte,
> +                subreg_lowpart_offset (as_a <scalar_int_mode> (outermode),
> +                                       as_a <scalar_int_mode> (innermode))))
>      {
> +      scalar_int_mode int_outermode = as_a <scalar_int_mode> (outermode);
> +      scalar_int_mode int_innermode = as_a <scalar_int_mode> (innermode);
> +
>        /* Handle polynomial integers.  The upper bits of a paradoxical
>        subreg are undefined, so this is safe regardless of whether
>        we're truncating or extending.  */
> 
> 
> 

-- 
Richard Biener <[email protected]>
SUSE Software Solutions Germany GmbH,
Frankenstrasse 146, 90461 Nuernberg, Germany;
GF: Stefan Gaiser, Jochen Jaser, Abhinav Puri; (HRB 36809, AG Nuernberg)

Reply via email to