From 2889419e10a68fad89df35350a1ea5e41e4cbf35 Mon Sep 17 00:00:00 2001 From: j00660176 Date: Wed, 12 Jul 2023 16:39:56 +0800 Subject: [PATCH] example/l3fwd: masking wrong warning array subscript [0] is partly outside array bounds GCC 12 raises the following warning: In file included from ../examples/l3fwd/l3fwd_lpm_neon.h:11, from ../examples/l3fwd/l3fwd_lpm.c:135: ../examples/l3fwd/l3fwd_neon.h: In function 'port_groupx4': ../examples/l3fwd/l3fwd_neon.h:95:21: error: array subscript 'union [0]' is partly outside array bounds of 'uint16_t[5]' {aka 'short unsigned int[5]'} [-Werror=array-bounds] 95 | pnum->u64 = gptbl[v].pnum; | ^~ ../examples/l3fwd/l3fwd_neon.h:74:23: note: object 'pn' of size [0, 10] 74 | port_groupx4(uint16_t pn[FWDSTEP + 1], uint16_t *lp, uint16x8_t dp1, | ~~~~~~~~~^~~~~~~~~~~~~~~ ../examples/l3fwd/l3fwd_neon.h:96:21: error: array subscript 'union [0]' is partly outside array bounds of 'uint16_t[5]' {aka 'short unsigned int[5]'} [-Werror=array-bounds] 96 | pnum->u16[FWDSTEP] = 1; | ^~ ../examples/l3fwd/l3fwd_neon.h:74:23: note: object 'pn' of size [0, 10] 74 | port_groupx4(uint16_t pn[FWDSTEP + 1], uint16_t *lp, uint16x8_t dp1, | ~~~~~~~~~^~~~~~~~~~~~~~~ cc1: all warnings being treated as errors according to the code review, this is a wrong warning: pnum's size is uint16_t * 5 = 10, FWDSTEP is 4, line 96 access pnum->[4]; lin95 access accesses a 64-bit value, taking up the first four elements of a number. due to patch 0002-dpdk-add-secure-compile-option-and-fPIC-option.patch, it treats warnings as errors. so the l3fwd compilation fails. --- examples/l3fwd/meson.build | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/l3fwd/meson.build b/examples/l3fwd/meson.build index 0830b3e..827206e 100644 --- a/examples/l3fwd/meson.build +++ b/examples/l3fwd/meson.build @@ -7,6 +7,8 @@ # DPDK instance, use 'make' allow_experimental_apis = true +cflags += ['-Wno-array-bounds'] + deps += ['hash', 'lpm', 'fib', 'eventdev'] sources = files( 'l3fwd_em.c', -- 2.33.0