DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] build: force gcc to initialize padding bits
@ 2025-01-23 17:20 Stephen Hemminger
  2025-01-24  7:48 ` Morten Brørup
  2025-01-24 18:26 ` [PATCH v2] " Stephen Hemminger
  0 siblings, 2 replies; 5+ messages in thread
From: Stephen Hemminger @ 2025-01-23 17:20 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Bruce Richardson

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@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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-01-24 18:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-23 17:20 [PATCH] build: force gcc to initialize padding bits Stephen Hemminger
2025-01-24  7:48 ` Morten Brørup
2025-01-24  9:38   ` Bruce Richardson
2025-01-24 18:37     ` Stephen Hemminger
2025-01-24 18:26 ` [PATCH v2] " Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).