[PATCH] stack: fix pile GCC memcpy warnings
Morten Brørup
mb at smartsharesystems.com
Tue Oct 20 17:27:02 CEST 2026
> From: Stephen Hemminger <stephen at networkplumber.org>
> Date: Tue, 20 Oct 2026 07:26:42 -0700
> Subject: [PATCH] build: disable GCC string op warnings when unoptimized
>
> Without optimization GCC's -Wstringop-overflow and -Wstringop-overread
> are flow-insensitive: they check a 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 at nvidia.com>
> Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
> ---
> config/meson.build | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/config/meson.build b/config/meson.build
> index 745097e8aa..ac90b9d4fa 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
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
lib/eal/ppc/include/rte_memcpy.h
With or without suggested changes,
Acked-by: Morten Brørup <mb at smartsharesystems.com>
More information about the dev
mailing list