On Wed, Apr 10, 2024 at 07:54:27PM +0200, Morten Brørup wrote: > > From: Stephen Hemminger [mailto:step...@networkplumber.org] > > Sent: Wednesday, 10 April 2024 17.27 > > > > On Wed, 10 Apr 2024 17:33:53 +0800 > > fengchengwen <fengcheng...@huawei.com> wrote: > > > > > Last: We think there are two ways to solve this problem. > > > 1. Add the compilation option '-fno-strict-aliasing' for hold DPDK > > project. > > > 2. Use union to avoid such aliasing in rte_eth_linkstatus_set (please > > see above). > > > PS: We prefer first way. > > > > > > > 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.
agree, union is the correct way to get defined behavior. there are valuable optimizatons that the compiler can make with strict aliasing enabled so -Wstrict-aliasing is a good suggestion as opposed to disabling it. also the union won't break the abi if introduced correctly.