> From: Robin Jarry [mailto:[email protected]]
> Sent: Monday, 30 November 2026 13.30
> 
> GCC 14 and 16 at -O0 report -Wstringop-overread when an inlined
> ring enqueue receives a 24-byte item. Without optimization, GCC
> diagnoses the 32-byte memcpy in the unreachable 128-bit copy path.
> The unoptimized-build warning flag does not apply to applications
> compiling DPDK headers, and the header-local suppression is gone.

I suppose this is what you are referring to:
https://patchwork.dpdk.org/project/dpdk/patch/[email protected]/

Maybe that needs to be moved from a meson file into a common header file 
instead, so it also applies to applications compiling DPDK header files.
@Bruce, would /lib/eal/include/rte_compat.h or rte_common.h be a good place for 
this? Or someplace else?

Before we move it, we should ask ourselves if it is acceptable to apply such a 
policy at application level; it would affect the application as a whole, not 
just the DPDK parts of the application.
Maybe we should re-introduce the header-local suppressions? (With comments 
describing that it is for compiling applications, not for compiling DPDK.)

> 
> Copy the pair as two 16-byte elements instead. This avoids the
> false warning without suppressing diagnostics for applications.
> Optimized x86-64 code still uses two 16-byte loads and stores.

"still uses"

AVX optimized uses one 32-byte load and store:
https://godbolt.org/z/3T76jsc9E

Please find another workaround.

> 
> Fixes: 812a18c167f4 ("build: disable GCC string op warnings when
> unoptimized")
> Cc: [email protected]
> Signed-off-by: Robin Jarry <[email protected]>
> ---
>  lib/ring/rte_ring_elem_pvt.h | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/ring/rte_ring_elem_pvt.h
> b/lib/ring/rte_ring_elem_pvt.h
> index 404bf1d8d24e..37e900b70d5b 100644
> --- a/lib/ring/rte_ring_elem_pvt.h
> +++ b/lib/ring/rte_ring_elem_pvt.h
> @@ -98,9 +98,12 @@ __rte_ring_enqueue_elems_128(void *ring_table, const
> void *obj_table,
>       const rte_int128_t *obj = (const rte_int128_t *)obj_table;
> 
>       if (likely(idx + n <= size)) {
> -             for (i = 0; i < (n & ~0x1); i += 2, idx += 2)
> +             for (i = 0; i < (n & ~0x1); i += 2, idx += 2) {
>                       memcpy((void *)(ring + idx),
> -                             (const void *)(obj + i), 32);
> +                             (const void *)(obj + i), 16);
> +                     memcpy((void *)(ring + idx + 1),
> +                             (const void *)(obj + i + 1), 16);
> +             }
>               switch (n & 0x1) {
>               case 1:
>                       memcpy((void *)(ring + idx),
> --
> 2.56.1

Reply via email to