With LTO, gcc inlines rte_soring_acquirx_bulk() into
test_soring_stages(). The element copy switches on the runtime
r->esize, so the 16-byte copy path stays live and gcc reports
-Wstringop-overflow writing into the 32 x uint32_t stack arrays.
That path is never taken since the ring is created with 4 byte
elements and metadata.

The diagnostic is emitted by lto1 at link time, so it cannot be
silenced from lib/ring. Disable it for the dpdk-test link only when
LTO is enabled with gcc; non-LTO builds are unchanged.

Bugzilla ID: 2101
Fixes: 70581c355d69 ("test/ring: add unit tests for soring API")

Signed-off-by: Stephen Hemminger <[email protected]>
---
 app/test/meson.build | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/app/test/meson.build b/app/test/meson.build
index 2f1cd817cd..d16ca9f287 100644
--- a/app/test/meson.build
+++ b/app/test/meson.build
@@ -277,6 +277,12 @@ extra_flags = [
         '-fno-strict-aliasing',
 ]
 
+# LTO inlines soring acquire into the test, gcc then flags the
+# unreachable 16-byte element copy path (false positive).
+if get_option('b_lto') and cc.get_id() == 'gcc'
+       ldflags += '-Wno-stringop-overflow'
+endif
+
 foreach arg: extra_flags
     if cc.has_argument(arg)
         cflags += arg
-- 
2.53.0

Reply via email to