[PATCH] malloc: Fix Os build on some ABIs

Yury Khrustalev yury.khrustalev@arm.com
Wed Mar 11 15:54:48 GMT 2026


On Sat, Sep 06, 2025 at 07:21:35PM -0300, Adhemerval Zanella wrote:
> I have not checked with all versions for all ABIs, but I saw failures
> with gcc-14 on arm, alpha, hppa, i686, sparc, sh4, and microblaze.
> ---
>  malloc/malloc.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/malloc/malloc.c b/malloc/malloc.c
> index 6c02af5a27..1896c55e21 100644
> --- a/malloc/malloc.c
> +++ b/malloc/malloc.c
> @@ -3305,10 +3305,16 @@ tcache_get_align (size_t nb, size_t alignment)
>            mangled = true;
>          }
>  
> +      /* GCC compiling for -Os warns on some architectures that csize maya be
> +	 uninitialized.  However, if 'te' is not NULL, csize is always
> +	 initialized in the loop above.  */
> +      DIAG_PUSH_NEEDS_COMMENT;
> +      DIAG_IGNORE_Os_NEEDS_COMMENT (12, "-Wmaybe-uninitialized");

This warning also shows up with -Og and I can't find an easy way to
define a similar macro for this case.

We should either silence this warning with DIAG_IGNORE_NEEDS_COMMENT
or initialise csize to 0 or something.

Kind regards,
Yury



More information about the Libc-alpha mailing list