pipeline: fix build with gcc 4.8.5

Message ID 20210421100638.19451-1-alialnu@nvidia.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series pipeline: fix build with gcc 4.8.5 |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-testing success Testing PASS
ci/Intel-compilation fail apply issues
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS

Commit Message

Ali Alnubani April 21, 2021, 10:06 a.m. UTC
  Compilation on CentOS 7 with gcc version 4.8.5 fails with
the following errors:
```
...
error: 'src_struct_id' may be used uninitialized in this
function [-Werror=maybe-uninitialized]
...
error: 'dst_struct_id' may be used uninitialized in this
function [-Werror=maybe-uninitialized]
...
```

This patch fixes the build errors by initializing both variables.

Bugzilla ID: 683
Fixes: 783768136f29 ("pipeline: auto-detect endianness of action arguments")
Cc: cristian.dumitrescu@intel.com

Signed-off-by: Ali Alnubani <alialnu@nvidia.com>
---
 lib/librte_pipeline/rte_swx_pipeline.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
  

Comments

Thomas Monjalon April 21, 2021, 10:41 a.m. UTC | #1
21/04/2021 12:06, Ali Alnubani:
> Compilation on CentOS 7 with gcc version 4.8.5 fails with
> the following errors:
> ```
> ...
> error: 'src_struct_id' may be used uninitialized in this
> function [-Werror=maybe-uninitialized]
> ...
> error: 'dst_struct_id' may be used uninitialized in this
> function [-Werror=maybe-uninitialized]
> ...
> ```
> 
> This patch fixes the build errors by initializing both variables.
> 
> Bugzilla ID: 683
> Fixes: 783768136f29 ("pipeline: auto-detect endianness of action arguments")
> Cc: cristian.dumitrescu@intel.com

This patch was depending on others so CI didn't run.
I've requested a partial CI run when dependencies resolved and it passed.
That's what happens when I merge a patch without a re-run of the full CI.
We really need to be able to re-run CI easily,
plus managing the dependencies in the CI.

> Signed-off-by: Ali Alnubani <alialnu@nvidia.com>

Applied, thanks
  

Patch

diff --git a/lib/librte_pipeline/rte_swx_pipeline.c b/lib/librte_pipeline/rte_swx_pipeline.c
index 4e358bbda4..a2732a1e57 100644
--- a/lib/librte_pipeline/rte_swx_pipeline.c
+++ b/lib/librte_pipeline/rte_swx_pipeline.c
@@ -3624,7 +3624,7 @@  instr_mov_translate(struct rte_swx_pipeline *p,
 	char *dst = tokens[1], *src = tokens[2];
 	struct field *fdst, *fsrc;
 	uint64_t src_val;
-	uint32_t dst_struct_id, src_struct_id;
+	uint32_t dst_struct_id = 0, src_struct_id = 0;
 
 	CHECK(n_tokens == 3, EINVAL);
 
@@ -3889,7 +3889,7 @@  instr_alu_add_translate(struct rte_swx_pipeline *p,
 	char *dst = tokens[1], *src = tokens[2];
 	struct field *fdst, *fsrc;
 	uint64_t src_val;
-	uint32_t dst_struct_id, src_struct_id;
+	uint32_t dst_struct_id = 0, src_struct_id = 0;
 
 	CHECK(n_tokens == 3, EINVAL);
 
@@ -3942,7 +3942,7 @@  instr_alu_sub_translate(struct rte_swx_pipeline *p,
 	char *dst = tokens[1], *src = tokens[2];
 	struct field *fdst, *fsrc;
 	uint64_t src_val;
-	uint32_t dst_struct_id, src_struct_id;
+	uint32_t dst_struct_id = 0, src_struct_id = 0;
 
 	CHECK(n_tokens == 3, EINVAL);
 
@@ -4072,7 +4072,7 @@  instr_alu_shl_translate(struct rte_swx_pipeline *p,
 	char *dst = tokens[1], *src = tokens[2];
 	struct field *fdst, *fsrc;
 	uint64_t src_val;
-	uint32_t dst_struct_id, src_struct_id;
+	uint32_t dst_struct_id = 0, src_struct_id = 0;
 
 	CHECK(n_tokens == 3, EINVAL);
 
@@ -4125,7 +4125,7 @@  instr_alu_shr_translate(struct rte_swx_pipeline *p,
 	char *dst = tokens[1], *src = tokens[2];
 	struct field *fdst, *fsrc;
 	uint64_t src_val;
-	uint32_t dst_struct_id, src_struct_id;
+	uint32_t dst_struct_id = 0, src_struct_id = 0;
 
 	CHECK(n_tokens == 3, EINVAL);
 
@@ -4178,7 +4178,7 @@  instr_alu_and_translate(struct rte_swx_pipeline *p,
 	char *dst = tokens[1], *src = tokens[2];
 	struct field *fdst, *fsrc;
 	uint64_t src_val;
-	uint32_t dst_struct_id, src_struct_id;
+	uint32_t dst_struct_id = 0, src_struct_id = 0;
 
 	CHECK(n_tokens == 3, EINVAL);
 
@@ -4231,7 +4231,7 @@  instr_alu_or_translate(struct rte_swx_pipeline *p,
 	char *dst = tokens[1], *src = tokens[2];
 	struct field *fdst, *fsrc;
 	uint64_t src_val;
-	uint32_t dst_struct_id, src_struct_id;
+	uint32_t dst_struct_id = 0, src_struct_id = 0;
 
 	CHECK(n_tokens == 3, EINVAL);
 
@@ -4284,7 +4284,7 @@  instr_alu_xor_translate(struct rte_swx_pipeline *p,
 	char *dst = tokens[1], *src = tokens[2];
 	struct field *fdst, *fsrc;
 	uint64_t src_val;
-	uint32_t dst_struct_id, src_struct_id;
+	uint32_t dst_struct_id = 0, src_struct_id = 0;
 
 	CHECK(n_tokens == 3, EINVAL);