[PATCH] build: force gcc to initialize padding bits
Stephen Hemminger
stephen at networkplumber.org
Thu Jan 23 18:20:47 CET 2025
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 <stephen at 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 = [
# globally disabled warnings
'-Wno-packed-not-aligned',
'-Wno-missing-field-initializers',
+
+ # guarantee that everything is zero when using initialization
+ '-fzero-init-padding-bits=all',
]
if not dpdk_conf.get('RTE_ARCH_64')
--
2.45.2
More information about the dev
mailing list