DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] build: disable GCC string op warnings when unoptimized
@ 2026-10-20 14:55 Stephen Hemminger
  2026-10-20 14:55 ` [PATCH 2/2] ring: remove GCC pragma Stephen Hemminger
  2026-10-20 15:33 ` [PATCH 1/2] build: disable GCC string op warnings when unoptimized Morten Brørup
  0 siblings, 2 replies; 4+ messages in thread
From: Stephen Hemminger @ 2026-10-20 14:55 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Ali Alnubani, Bruce Richardson

Without optimization GCC produces warnings for unreachable code paths.
They check memcpy() against the object size even on paths that are dead
for the inlined arguments. This breaks debug builds of app/test
with -Werror on lib/stack/rte_stack_pile.h,
and has required local pragma workarounds elsewhere.

Disable both warnings when optimization is 0. They stay enabled for
optimized builds, where the analysis is flow-sensitive.

Bugzilla ID: 2061

Reported-by: Ali Alnubani <alialnu@nvidia.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 config/meson.build | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/config/meson.build b/config/meson.build
index 745097e8aa..bfac1cd93d 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -378,6 +378,12 @@ if cc.has_argument('-Wno-comma')
     no_comma_cflag = '-Wno-comma'
 endif
 
+# GCC's string/memory access warnings are flow-insensitive without
+# optimization and produce false positives on dead paths of inlined code.
+if get_option('optimization') == '0' and cc.get_id() == 'gcc'
+    global_cflags += ['-Wno-stringop-overflow', '-Wno-stringop-overread']
+endif
+
 foreach arg: global_cflags
     if cc.has_argument(arg)
         add_project_arguments(arg, language: 'c')
-- 
2.53.0


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

end of thread, other threads:[~2026-10-20 18:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-20 14:55 [PATCH 1/2] build: disable GCC string op warnings when unoptimized Stephen Hemminger
2026-10-20 14:55 ` [PATCH 2/2] ring: remove GCC pragma Stephen Hemminger
2026-10-20 15:33 ` [PATCH 1/2] build: disable GCC string op warnings when unoptimized Morten Brørup
2026-10-20 18:01   ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox