1 Star 0 Fork 75

sky/dpdk

forked from src-openEuler/dpdk 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0023-example-l3fwd-masking-wrong-warning-array-subscript-.patch 2.22 KB
一键复制 编辑 原始数据 按行查看 历史
jinag12 提交于 2023-07-12 11:47 . fix build with GCC 12
From 2889419e10a68fad89df35350a1ea5e41e4cbf35 Mon Sep 17 00:00:00 2001
From: j00660176 <jiangheng14@huawei.com>
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 <anonymous>[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 <anonymous>[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
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/nlgwcy/dpdk.git
git@gitee.com:nlgwcy/dpdk.git
nlgwcy
dpdk
dpdk
master

搜索帮助