diff mbox series

[v2] node: fix arm64 build issue for older gcc

Message ID 20200513120605.28912-1-ndabilpuram@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers show
Series [v2] node: fix arm64 build issue for older gcc | expand

Checks

Context Check Description
ci/iol-testing fail Testing issues
ci/Intel-compilation fail apply issues
ci/travis-robot success Travis build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-nxp-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/checkpatch success coding style OK

Commit Message

Nithin Dabilpuram May 13, 2020, 12:06 p.m. UTC
Older GCC(~4) complains about uninitialized 'dip'
var though all the lanes of the vec register are set.
Hence this patch explicitly initializes vec register
to fix the issue.

In file included from ip4_lookup.c:34:0:
ip4_lookup_neon.h: n function ‘ip4_lookup_node_process’: \
ip4_lookup_neon.h:25:12: error: ‘dip’ may be used uninitialized in \
				this function [-Werror=maybe-uninitialized]
  int32x4_t dip;
            ^

Fixes: 16df6a2c6671 ("node: add IPv4 lookup for arm64")

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
v2:
- Add error in commit msg.

 lib/librte_node/ip4_lookup_neon.h | 1 +
 1 file changed, 1 insertion(+)

Comments

Jerin Jacob May 13, 2020, 12:36 p.m. UTC | #1
On Wed, May 13, 2020 at 5:36 PM Nithin Dabilpuram
<ndabilpuram@marvell.com> wrote:
>
> Older GCC(~4) complains about uninitialized 'dip'
> var though all the lanes of the vec register are set.
> Hence this patch explicitly initializes vec register
> to fix the issue.
>
> In file included from ip4_lookup.c:34:0:
> ip4_lookup_neon.h: n function ‘ip4_lookup_node_process’: \
> ip4_lookup_neon.h:25:12: error: ‘dip’ may be used uninitialized in \
>                                 this function [-Werror=maybe-uninitialized]
>   int32x4_t dip;
>             ^
>
> Fixes: 16df6a2c6671 ("node: add IPv4 lookup for arm64")
>

Reported-by: David Marchand <david.marchand@redhat.com>

> Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>

It is a false positive, all the lines are updated by the c code.
Just to make the old compiler to happy we need to add unnecessary
additional instruction.
Looks like there is no other clean way to suppress the warning.

Reviewed-by: Jerin Jacob <jerinj@marvell.com>


> ---
> v2:
> - Add error in commit msg.
>
>  lib/librte_node/ip4_lookup_neon.h | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/lib/librte_node/ip4_lookup_neon.h b/lib/librte_node/ip4_lookup_neon.h
> index bb3150f..dd21cb2 100644
> --- a/lib/librte_node/ip4_lookup_neon.h
> +++ b/lib/librte_node/ip4_lookup_neon.h
> @@ -45,6 +45,7 @@ ip4_lookup_node_process(struct rte_graph *graph, struct rte_node *node,
>                 rte_prefetch0(rte_pktmbuf_mtod_offset(pkts[i], void *,
>                                                 sizeof(struct rte_ether_hdr)));
>
> +       dip = vdupq_n_s32(0);
>         /* Get stream for the speculated next node */
>         to_next = rte_node_next_stream_get(graph, node, next_index, nb_objs);
>         while (n_left_from >= 4) {
> --
> 2.8.4
>
David Marchand May 13, 2020, 1:03 p.m. UTC | #2
On Wed, May 13, 2020 at 2:36 PM Jerin Jacob <jerinjacobk@gmail.com> wrote:
>
> On Wed, May 13, 2020 at 5:36 PM Nithin Dabilpuram
> <ndabilpuram@marvell.com> wrote:
> >
> > Older GCC(~4) complains about uninitialized 'dip'
> > var though all the lanes of the vec register are set.
> > Hence this patch explicitly initializes vec register
> > to fix the issue.
> >
> > In file included from ip4_lookup.c:34:0:
> > ip4_lookup_neon.h: n function ‘ip4_lookup_node_process’: \
> > ip4_lookup_neon.h:25:12: error: ‘dip’ may be used uninitialized in \
> >                                 this function [-Werror=maybe-uninitialized]
> >   int32x4_t dip;
> >             ^
> >
> > Fixes: 16df6a2c6671 ("node: add IPv4 lookup for arm64")
>
> Reported-by: David Marchand <david.marchand@redhat.com>
> > Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
> > Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> Reviewed-by: Jerin Jacob <jerinj@marvell.com>

Applied, thanks.
diff mbox series

Patch

diff --git a/lib/librte_node/ip4_lookup_neon.h b/lib/librte_node/ip4_lookup_neon.h
index bb3150f..dd21cb2 100644
--- a/lib/librte_node/ip4_lookup_neon.h
+++ b/lib/librte_node/ip4_lookup_neon.h
@@ -45,6 +45,7 @@  ip4_lookup_node_process(struct rte_graph *graph, struct rte_node *node,
 		rte_prefetch0(rte_pktmbuf_mtod_offset(pkts[i], void *,
 						sizeof(struct rte_ether_hdr)));
 
+	dip = vdupq_n_s32(0);
 	/* Get stream for the speculated next node */
 	to_next = rte_node_next_stream_get(graph, node, next_index, nb_objs);
 	while (n_left_from >= 4) {