* [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
* [PATCH 2/2] ring: remove GCC pragma
2026-10-20 14:55 [PATCH 1/2] build: disable GCC string op warnings when unoptimized Stephen Hemminger
@ 2026-10-20 14:55 ` Stephen Hemminger
2026-10-20 15:33 ` [PATCH 1/2] build: disable GCC string op warnings when unoptimized Morten Brørup
1 sibling, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2026-10-20 14:55 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Konstantin Ananyev, Wathsala Vithanage
The original issue that required using pragma here to disable
stringop warnings is now handled at in config/meson.build
across all files.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/ring/rte_ring_elem_pvt.h | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/lib/ring/rte_ring_elem_pvt.h b/lib/ring/rte_ring_elem_pvt.h
index 29758d0bb8..3d680749ad 100644
--- a/lib/ring/rte_ring_elem_pvt.h
+++ b/lib/ring/rte_ring_elem_pvt.h
@@ -10,12 +10,6 @@
#ifndef _RTE_RING_ELEM_PVT_H_
#define _RTE_RING_ELEM_PVT_H_
-#if defined(RTE_TOOLCHAIN_GCC) && (GCC_VERSION >= 120000)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wstringop-overflow"
-#pragma GCC diagnostic ignored "-Wstringop-overread"
-#endif
-
static __rte_always_inline void
__rte_ring_enqueue_elems_32(void *ring_table, const void *obj_table,
uint32_t size, uint32_t idx, uint32_t n)
@@ -500,8 +494,4 @@ __rte_ring_do_dequeue_elem(struct rte_ring *r, void *obj_table,
return n;
}
-#if defined(RTE_TOOLCHAIN_GCC) && (GCC_VERSION >= 120000)
-#pragma GCC diagnostic pop
-#endif
-
#endif /* _RTE_RING_ELEM_PVT_H_ */
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [PATCH 1/2] build: disable GCC string op warnings when unoptimized
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 ` Morten Brørup
2026-10-20 18:01 ` Stephen Hemminger
1 sibling, 1 reply; 4+ messages in thread
From: Morten Brørup @ 2026-10-20 15:33 UTC (permalink / raw)
To: Stephen Hemminger, dev; +Cc: Ali Alnubani, Bruce Richardson
> From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> Sent: Tuesday, 20 October 2026 16.56
>
> 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
I replied in the wrong thread, here it comes again:
Also '-Warray-bounds'?
Consider making it a series, and also remove existing overflow/overread pragmas in the code (if viable):
lib/ring/rte_ring_elem_pvt.h - You did this already!
lib/eal/ppc/include/rte_memcpy.h
With or without suggested changes,
Acked-by: Morten Brørup <mb@smartsharesystems.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] build: disable GCC string op warnings when unoptimized
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
0 siblings, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2026-10-20 18:01 UTC (permalink / raw)
To: Morten Brørup; +Cc: dev, Ali Alnubani, Bruce Richardson
On Tue, 20 Oct 2026 17:33:32 +0200
Morten Brørup <mb@smartsharesystems.com> wrote:
> I replied in the wrong thread, here it comes again:
>
> Also '-Warray-bounds'?
No, if it doesn't trip today, then no need to change.
>
> Consider making it a series, and also remove existing overflow/overread pragmas in the code (if viable):
> lib/ring/rte_ring_elem_pvt.h - You did this already!
> lib/eal/ppc/include/rte_memcpy.h
PPC rte_memcpy is doing something different and likely
because of different versions of GCC.
Not sure in general how supported ppc is so left it alone.
>
> With or without suggested changes,
^ permalink raw reply [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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.