Hello,
thanks for sending this. A couple of typo callouts below:
On Fri, 5 Jun 2026, Xi Ruoyao wrote:
> So we don't make the same error again.
>
> gcc/
>
> PR rtl-optimization/125609
> PR middle-end/122992
> * hard-reg-set.h
> (build_error_execute_if_set_in_hard_reg_temp_set): New
Wrong name in parens.
> function.
> (EXECUTE_IF_SET_IN_HARD_REG_SET): Call the function above.
>
> Bootstrapped and regtested on loongarch64-linux-gnu. Ok for trunk?
>
> ---
> gcc/hard-reg-set.h | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/gcc/hard-reg-set.h b/gcc/hard-reg-set.h
> index df56a3acedb..0465c5aab77 100644
> --- a/gcc/hard-reg-set.h
> +++ b/gcc/hard-reg-set.h
> @@ -401,10 +401,20 @@ hard_reg_set_iter_next (hard_reg_set_iterator *iter,
> unsigned *)
> iter->bits &= ~ HARD_CONST (1);
> }
>
> -/* SET must not change throughout the iteration.
> +template <typename T>
> +inline void
> +build_error_on_rvalue (T &&)
> +{
> + static_assert (!std::is_rvalue_reference<T&&>::value, "");
> +}
> +
> +/* SET must not change throughout the iteration. It's lifetime must
"Its" (not "it's").
Also, perhaps "Its lifetime must cover the entire loop" for clarity?
> + exceed the iteration so we call build_error_on_rvalue() to reject a
> + temporary object as SET.
> REGNUM (and ITER) may only be changed by the iteration functions. */
> #define EXECUTE_IF_SET_IN_HARD_REG_SET(SET, MIN, REGNUM, ITER) \
> - for (hard_reg_set_iter_init (&(ITER), (SET), (MIN), &(REGNUM)); \
> + for (build_error_on_rvalue (SET), \
> + hard_reg_set_iter_init (&(ITER), (SET), (MIN), &(REGNUM)); \
> hard_reg_set_iter_set (&(ITER), &(REGNUM)); \
> hard_reg_set_iter_next (&(ITER), &(REGNUM)))
Alexander