DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Morten Brørup" <mb@smartsharesystems.com>
To: "Stephen Hemminger" <stephen@networkplumber.org>, <dev@dpdk.org>
Cc: "Ali Alnubani" <alialnu@nvidia.com>,
	"Bruce Richardson" <bruce.richardson@intel.com>
Subject: RE: [PATCH 1/2] build: disable GCC string op warnings when unoptimized
Date: Tue, 20 Oct 2026 17:33:32 +0200	[thread overview]
Message-ID: <98CBD80474FA8B44BF855DF32C47DC35F65ACF@smartserver.smartshare.dk> (raw)
In-Reply-To: <20261020145541.388371-1-stephen@networkplumber.org>

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


  parent reply	other threads:[~2026-10-20 15:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2026-10-20 18:01   ` [PATCH 1/2] build: disable GCC string op warnings when unoptimized Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=98CBD80474FA8B44BF855DF32C47DC35F65ACF@smartserver.smartshare.dk \
    --to=mb@smartsharesystems.com \
    --cc=alialnu@nvidia.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox