[dpdk-dev] [PATCH v1] app/test: zcd needs to be initialised to fix gcc compile error

Honnappa Nagarahalli Honnappa.Nagarahalli at arm.com
Wed Nov 4 19:48:10 CET 2020


Hi Conor,
	Thanks for the patch.

<snip>

> 
> When DPDK is compiled with gcc < 9 with the optimization level set to 1 gcc
> sees zcd in test_ring.h as possibly being uninitialised. To correct this error zcd
> has been initialised to {0} in test_ring_mt_peek_stress_zc.c.
> 
> Signed-off-by: Conor Walsh <conor.walsh at intel.com>
> ---
>  app/test/test_ring_mt_peek_stress_zc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/app/test/test_ring_mt_peek_stress_zc.c
> b/app/test/test_ring_mt_peek_stress_zc.c
> index 7e0bd511a7..ba0acf237c 100644
> --- a/app/test/test_ring_mt_peek_stress_zc.c
> +++ b/app/test/test_ring_mt_peek_stress_zc.c
> @@ -11,7 +11,7 @@ _st_ring_dequeue_bulk(struct rte_ring *r, void **obj,
> uint32_t n,
>  	uint32_t *avail)
>  {
>  	uint32_t m;
> -	struct rte_ring_zc_data zcd;
> +	struct rte_ring_zc_data zcd = {0};
I faced similar problems when I created this test case. I refrained from doing this initialization as it might mask the problems in the library. Is it possible to identify which path in the library is actually resulting in this error? I would prefer to fix that instead.

> 
>  	m = rte_ring_dequeue_zc_bulk_start(r, n, &zcd, avail);
>  	n = (m == n) ? n : 0;
> @@ -29,7 +29,7 @@ _st_ring_enqueue_bulk(struct rte_ring *r, void * const
> *obj, uint32_t n,
>  	uint32_t *free)
>  {
>  	uint32_t m;
> -	struct rte_ring_zc_data zcd;
> +	struct rte_ring_zc_data zcd = {0};
> 
>  	m = rte_ring_enqueue_zc_bulk_start(r, n, &zcd, free);
>  	n = (m == n) ? n : 0;
> --
> 2.25.1



More information about the dev mailing list