DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/3] ring: fix build for gcc O1 optimization
@ 2020-05-07 12:02 Ferruh Yigit
  2020-05-07 12:02 ` [dpdk-dev] [PATCH 2/3] mempool/octeontx2: " Ferruh Yigit
                   ` (4 more replies)
  0 siblings, 5 replies; 20+ messages in thread
From: Ferruh Yigit @ 2020-05-07 12:02 UTC (permalink / raw)
  To: Honnappa Nagarahalli, Konstantin Ananyev
  Cc: dev, Ferruh Yigit, Thomas Monjalon, David Marchand

Can be reproduced with "make EXTRA_CFLAGS='-O1'" command using
gcc (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2)

Two build errors:
1)
In file included from .../build/include/rte_ring_elem.h:1093,
                 from .../lib/librte_rcu/rte_rcu_qsbr.c:21:
../lib/librte_rcu/rte_rcu_qsbr.c: In function ‘rte_rcu_qsbr_dq_reclaim’:
.../build/include/rte_ring_peek.h:282:22:
    error: ‘avail’ may be used uninitialized in this function
           [-Werror=maybe-uninitialized]
  282 |   *available = avail - n;
      |                ~~~~~~^~~
./build/include/rte_ring_peek.h:259:11: note: ‘avail’ was declared here
  259 |  uint32_t avail, head, next;
      |           ^~~~~

2)
In file included from .../build/include/rte_ring_elem.h:1093,
                 from .../build/include/rte_ring.h:405,
                 from .../app/test/test_ring_stress.h:13,
                 from .../app/test/test_ring_stress_impl.h:5,
                 from .../app/test/test_ring_peek_stress.c:5:
.../app/test/test_ring_peek_stress.c: In function ‘_st_ring_enqueue_bulk’:
.../build/include/rte_ring_peek.h:80:22:
    error: ‘free’ may be used uninitialized in this function
           [-Werror=maybe-uninitialized]
   80 |   *free_space = free - n;
      |                 ~~~~~^~~
.../build/include/rte_ring_peek.h:60:11: note: ‘free’ was declared here
   60 |  uint32_t free, head, next;
      |           ^~~~

The cases shouldn't be hit, and it looks like there is already logic
error if it has been hit, but assigning 'avail' & 'free' to '0' to fix
the build error.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 lib/librte_ring/rte_ring_peek.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/librte_ring/rte_ring_peek.h b/lib/librte_ring/rte_ring_peek.h
index d5e6ea1cf3..45f707dc7e 100644
--- a/lib/librte_ring/rte_ring_peek.h
+++ b/lib/librte_ring/rte_ring_peek.h
@@ -74,6 +74,7 @@ __rte_ring_do_enqueue_start(struct rte_ring *r, uint32_t n,
 		/* unsupported mode, shouldn't be here */
 		RTE_ASSERT(0);
 		n = 0;
+		free = 0;
 	}
 
 	if (free_space != NULL)
@@ -273,6 +274,7 @@ __rte_ring_do_dequeue_start(struct rte_ring *r, void *obj_table,
 		/* unsupported mode, shouldn't be here */
 		RTE_ASSERT(0);
 		n = 0;
+		avail = 0;
 	}
 
 	if (n != 0)
-- 
2.25.4


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2020-05-11 19:13 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-07 12:02 [dpdk-dev] [PATCH 1/3] ring: fix build for gcc O1 optimization Ferruh Yigit
2020-05-07 12:02 ` [dpdk-dev] [PATCH 2/3] mempool/octeontx2: " Ferruh Yigit
2020-05-07 14:05   ` Ananyev, Konstantin
2020-05-08 16:20     ` Ferruh Yigit
2020-05-08 16:39       ` Ferruh Yigit
2020-05-07 12:02 ` [dpdk-dev] [PATCH 3/3] net/ena: fix build for " Ferruh Yigit
2020-05-08 13:59   ` Michał Krawczyk
2020-05-07 13:47 ` [dpdk-dev] [PATCH 1/3] ring: fix build for gcc " Ananyev, Konstantin
2020-05-08 16:45 ` [dpdk-dev] [PATCH v2 1/4] " Ferruh Yigit
2020-05-08 16:45   ` [dpdk-dev] [PATCH v2 2/4] mempool/octeontx2: " Ferruh Yigit
2020-05-10 11:51     ` Jerin Jacob
2020-05-08 16:45   ` [dpdk-dev] [PATCH v2 3/4] net/ena: fix build for " Ferruh Yigit
2020-05-08 16:45   ` [dpdk-dev] [PATCH v2 4/4] event/octeontx2: " Ferruh Yigit
2020-05-08 17:22     ` Ananyev, Konstantin
2020-05-10 11:53       ` Jerin Jacob
2020-05-11 16:07 ` [dpdk-dev] [PATCH v3 1/4] ring: fix build for gcc " Ferruh Yigit
2020-05-11 16:07   ` [dpdk-dev] [PATCH v3 2/4] mempool/octeontx2: " Ferruh Yigit
2020-05-11 16:07   ` [dpdk-dev] [PATCH v3 3/4] net/ena: fix build for " Ferruh Yigit
2020-05-11 16:07   ` [dpdk-dev] [PATCH v3 4/4] event/octeontx2: " Ferruh Yigit
2020-05-11 19:13   ` [dpdk-dev] [PATCH v3 1/4] ring: fix build for gcc " Thomas Monjalon

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