DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: "Morten Brørup" <mb@smartsharesystems.com>
Cc: "fengchengwen" <fengchengwen@huawei.com>,
	"Ferruh Yigit" <ferruh.yigit@amd.com>, <dev@dpdk.org>,
	"Dengdui Huang" <huangdengdui@huawei.com>
Subject: Re: Strict aliasing problem with rte_eth_linkstatus_set()
Date: Wed, 10 Apr 2024 14:18:22 -0700	[thread overview]
Message-ID: <20240410141822.0fe8c10a@hermes.local> (raw)
In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35E9F391@smartserver.smartshare.dk>

On Wed, 10 Apr 2024 19:54:27 +0200
Morten Brørup <mb@smartsharesystems.com> wrote:

> > Please send a patch to replace alias with union.  
> 
> +1
> 
> Fixing this specific bug would be good.
> 
> Instinctively, I think we should build with -fno-strict-aliasing, so the compiler doesn't make the same mistake with similar code elsewhere in DPDK. I fear there is more than this instance.
> I also wonder if -Wstrict-aliasing could help us instead, if we don't want -fno-strict-aliasing.


Strict aliasing checks should be enabled already if you use warning_level 2
and default (debugoptimized) or release build types. Unless some part of DPDK
meson config is not overriding that.

  https://mesonbuild.com/Builtin-options.html

Warning level 2 sets -Wall and -Wextra
From gcc man page

       -Wstrict-aliasing
           This option is only active when -fstrict-aliasing  is  active.   It
           warns  about  code  that might break the strict aliasing rules that
           the compiler is using for optimization.  The warning does not catch
           all cases, but does attempt to catch the more common pitfalls.   It
           is included in -Wall.  It is equivalent to -Wstrict-aliasing=3

and
           The -fstrict-aliasing option is enabled at levels -O2, -O3, -Os.



      parent reply	other threads:[~2024-04-10 21:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-10  9:33 fengchengwen
2024-04-10 10:30 ` Morten Brørup
2024-04-10 15:57   ` Ferruh Yigit
2024-04-11  2:03   ` fengchengwen
2024-04-10 15:27 ` Stephen Hemminger
2024-04-10 15:58   ` Ferruh Yigit
2024-04-10 17:54   ` Morten Brørup
2024-04-10 19:58     ` Tyler Retzlaff
2024-04-11  3:20       ` fengchengwen
2024-04-10 21:18     ` Stephen Hemminger [this message]

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=20240410141822.0fe8c10a@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=fengchengwen@huawei.com \
    --cc=ferruh.yigit@amd.com \
    --cc=huangdengdui@huawei.com \
    --cc=mb@smartsharesystems.com \
    /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;
as well as URLs for NNTP newsgroup(s).