numam-dpdk/lib/librte_ring
Ferruh Yigit 867b49d17a ring: fix build for gcc O1 optimization
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>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2020-05-11 19:20:54 +02:00
..
Makefile ring: introduce peek style API 2020-04-21 12:52:55 +02:00
meson.build ring: introduce peek style API 2020-04-21 12:52:55 +02:00
rte_ring_c11_mem.h ring/c11: relax ordering for load and store of the head 2018-11-13 17:00:58 +01:00
rte_ring_core.h ring: introduce HTS ring mode 2020-04-21 12:52:55 +02:00
rte_ring_elem.h ring: introduce peek style API 2020-04-21 12:52:55 +02:00
rte_ring_generic.h ring: enforce reading tail before slots 2019-03-28 01:22:04 +01:00
rte_ring_hts_c11_mem.h ring: introduce HTS ring mode 2020-04-21 12:52:55 +02:00
rte_ring_hts.h ring: introduce HTS ring mode 2020-04-21 12:52:55 +02:00
rte_ring_peek_c11_mem.h ring: introduce peek style API 2020-04-21 12:52:55 +02:00
rte_ring_peek.h ring: fix build for gcc O1 optimization 2020-05-11 19:20:54 +02:00
rte_ring_rts_c11_mem.h ring: introduce RTS ring mode 2020-04-21 12:52:55 +02:00
rte_ring_rts.h ring: introduce RTS ring mode 2020-04-21 12:52:55 +02:00
rte_ring_version.map ring: support configurable element size 2020-01-19 19:32:48 +01:00
rte_ring.c ring: introduce HTS ring mode 2020-04-21 12:52:55 +02:00
rte_ring.h ring: introduce peek style API 2020-04-21 12:52:55 +02:00