On Wed, 13 Nov 2024, Christophe Lyon wrote:

> We recently forced -Werror when building libgcc for aarch64, to make
> sure we'd catch and fix the kind of problem described in the PR.
> 
> In this case, when building for aarch64_be (so, big endian), gcc emits
> this warning/error:
> libgcc/config/libbid/bid_conf.h:847:25: error: missing braces around 
> initializer [-Werror=missing-braces]
>   847 |        UINT128 arg_name={ bid_##arg_name.w[1], bid_##arg_name.w[0]};
> libgcc/config/libbid/bid_conf.h:871:8: note: in expansion of macro 
> 'COPY_ARG_VAL'
>   871 |        COPY_ARG_VAL(arg_name)
> 
> This patch fixes the problem by adding curly braces around the
> initializer for COPY_ARG_VAL in the big endian case.
> 
> It seems that COPY_ARG_REF (just above COPY_ARG_VAL) has a similar
> issue, but DECIMAL_CALL_BY_REFERENCE seems always defined to 0, so
> COPY_ARG_REF is never used.  The patch fixes it too, though.

OK.

Richard.

> libgcc/config/libbid/ChangeLog:
> 
>       PR libgcc/117537
>       * bid_conf.h (COPY_ARG_REF): Fix initializer.
>       (COPY_ARG_VAL): Likewise.
> ---
>  libgcc/config/libbid/bid_conf.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libgcc/config/libbid/bid_conf.h b/libgcc/config/libbid/bid_conf.h
> index e054a3ff570..5414ee1d2bd 100644
> --- a/libgcc/config/libbid/bid_conf.h
> +++ b/libgcc/config/libbid/bid_conf.h
> @@ -842,9 +842,9 @@ extern BID_THREAD _IDEC_excepthandling 
> _IDEC_glbexcepthandling;
>  
>  #if BID_BIG_ENDIAN
>  #define COPY_ARG_REF(arg_name) \
> -       UINT128 arg_name={ pbid_##arg_name->w[1], pbid_##arg_name->w[0]};
> +       UINT128 arg_name={ { pbid_##arg_name->w[1], pbid_##arg_name->w[0] }};
>  #define COPY_ARG_VAL(arg_name) \
> -       UINT128 arg_name={ bid_##arg_name.w[1], bid_##arg_name.w[0]};
> +       UINT128 arg_name={ { bid_##arg_name.w[1], bid_##arg_name.w[0] }};
>  #else
>  #define COPY_ARG_REF(arg_name) \
>         UINT128 arg_name=*pbid_##arg_name;
> 

-- 
Richard Biener <rguent...@suse.de>
SUSE Software Solutions Germany GmbH,
Frankenstrasse 146, 90461 Nuernberg, Germany;
GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)

Reply via email to