RE: [PATCH v12 3/3] eal/net: add workaround for GCC optimization bug

Morten Brørup
2026-01-11T17:58:00Z

> From: Scott Mitchell [mailto:scott.k.mitch1@gmail.com]
> Sent: Sunday, 11 January 2026 07.22
>
> > Does this still happen after you replaced the RTE_PTR_ADD() with
> native pointer arithmetic in the checksum function?
> > In other words: Is this workaround still necessary?
>
> Yes unfortunately it is necessary with the pointer access.
> I updated the reproducer which shows this case:
> https://gist.github.com/Scottmitch/bf23748b4588e68c9bdb8d124f92f1bd

I wonder if some of the magic types in rte_memcpy() [1] could be used to fix the aliasing/eliding problem in the checksum function:

struct __rte_packed_begin rte_unaligned_uint16_alias {
unaligned_uint16_t val;
} __rte_packed_end __rte_may_alias;

[1]: https://elixir.bootlin.com/dpdk/v25.11/source/lib/eal/x86/include/rte_memcpy.h#L66