[PATCH 19.11] net/ice: fix meson build error with gcc11.2

Steve Yang stevex.yang at intel.com
Wed Aug 3 08:12:45 CEST 2022


When user built latest DPDK 19.11 with gcc11.2, got error message as below:

../drivers/net/ice/ice_rxtx.c:1365:18: error: array subscript
‘volatile struct ice_32b_rx_flex_desc_comms[0]’ is partly outside array
bounds of ‘union ice_16b_rx_flex_desc[1]’ [-Werror=array-bounds]
 1365 |         stat_err = rte_le_to_cpu_16(desc->status_error0);
../drivers/net/ice/ice_rxtx.c:2090:32: note: while referencing ‘rxd’
 2090 |         union ice_rx_flex_desc rxd;
      |                                ^~~
In file included from ../lib/librte_mbuf/rte_mbuf.h:43,
                 from ../lib/librte_net/rte_ether.h:23,
                 from ../lib/librte_ethdev/rte_ethdev.h:159,
                 from ../lib/librte_ethdev/rte_ethdev_driver.h:18,
                 from ../drivers/net/ice/ice_rxtx.c:5:
cc1: all warnings being treated as errors

Because the 'desc->status_error0' belongs to 'ice_16b_rx_flex_desc[0]',
it cannot be outside array bounds, so, this warning should be skipped
with gcc option '-Wno-array-bounds' for gcc11.2.

Bugzilla ID: 1055
Fixes: dbf3c0e77a22 ("net/ice: handle Rx flex descriptor")

Signed-off-by: Steve Yang <stevex.yang at intel.com>
---
 drivers/net/ice/meson.build | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/ice/meson.build b/drivers/net/ice/meson.build
index f9e897bbc2..3c62ed7306 100644
--- a/drivers/net/ice/meson.build
+++ b/drivers/net/ice/meson.build
@@ -18,6 +18,10 @@ sources = files(
 deps += ['hash']
 includes += include_directories('base')
 
+if (toolchain == 'gcc' and cc.version().version_compare('>=11.0.0'))
+	cflags += '-Wno-array-bounds'
+endif
+
 if arch_subdir == 'x86'
 	sources += files('ice_rxtx_vec_sse.c')
 
-- 
2.25.1



More information about the stable mailing list