DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ali Alnubani <alialnu@nvidia.com>
To: <dev@dpdk.org>
Cc: <cristian.dumitrescu@intel.com>
Subject: [dpdk-dev] [PATCH] pipeline: fix build with gcc 4.8.5
Date: Wed, 21 Apr 2021 13:06:38 +0300	[thread overview]
Message-ID: <20210421100638.19451-1-alialnu@nvidia.com> (raw)

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(-)

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);
 
-- 
2.25.1


             reply	other threads:[~2021-04-21 10:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-21 10:06 Ali Alnubani [this message]
2021-04-21 10:41 ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210421100638.19451-1-alialnu@nvidia.com \
    --to=alialnu@nvidia.com \
    --cc=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).