On Wed, 10 Apr 2024 19:54:27 +0200 Morten Brørup <m...@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.