> From: Stephen Hemminger [mailto:step...@networkplumber.org]
> Sent: Thursday, 23 January 2025 18.21
> 
> With GCC 15, the compiler has changed the default behavior when
> initialization is used for aggregate variables. The new default
> is to follow the standard (C23) and not initialize everything by
> default. This breaks assumptions in some drivers and can be
> lead to other bugs.
> 
> Use the new zero initialization flag to force the old behavior
> of initializing everything to zero.
> 
> Signed-off-by: Stephen Hemminger <step...@networkplumber.org>
> ---
>  config/meson.build | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/config/meson.build b/config/meson.build
> index 6aaad6d8a4..5c8b5a15f5 100644
> --- a/config/meson.build
> +++ b/config/meson.build
> @@ -330,6 +330,9 @@ warning_flags = [

Is warning_flags the right location for this?
Alternatively, should warning_flags be renamed?

>          # globally disabled warnings
>          '-Wno-packed-not-aligned',
>          '-Wno-missing-field-initializers',
> +
> +        # guarantee that everything is zero when using initialization

Maybe add ", like in the C23 standard" to the comment.

> +        '-fzero-init-padding-bits=all',
>  ]
> 
>  if not dpdk_conf.get('RTE_ARCH_64')
> --
> 2.45.2

I have read up on -fzero-init-padding-bits, and this is the correct solution.

With or without suggested changes:
Acked-by: Morten Brørup <m...@smartsharesystems.com>

Reply via email to