[dpdk-dev] [PATCH v2] app/test: fix to prevent zcd gcc compile error

Honnappa Nagarahalli Honnappa.Nagarahalli at arm.com
Wed Nov 11 17:18:23 CET 2020



> -----Original Message-----
> From: Conor Walsh <conor.walsh at intel.com>
> Sent: Tuesday, November 10, 2020 5:03 AM
> To: Honnappa Nagarahalli <Honnappa.Nagarahalli at arm.com>;
> konstantin.ananyev at intel.com
> Cc: dev at dpdk.org; linglix.chen at intel.com; Conor Walsh
> <conor.walsh at intel.com>
> Subject: [PATCH v2] app/test: fix to prevent zcd gcc compile error
> 
> 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 if
> statements from _st_ring_dequeue_bulk and _st_ring_enqueue_bulk were
> corrected within test_ring_mt_peek_stress_zc.c
> 
> Signed-off-by: Conor Walsh <conor.walsh at intel.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli at arm.com>

> 
> ---
> 
> v2: Moved from initialising zcd to changing if statements within
>     test_ring_mt_peek_stress_zc.c following list feedback as the
>     original method used may have masked errors within the library.
> ---
>  app/test/test_ring_mt_peek_stress_zc.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 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..85f0262ba0 100644
> --- a/app/test/test_ring_mt_peek_stress_zc.c
> +++ b/app/test/test_ring_mt_peek_stress_zc.c
> @@ -14,8 +14,7 @@ _st_ring_dequeue_bulk(struct rte_ring *r, void **obj,
> uint32_t n,
>  	struct rte_ring_zc_data zcd;
> 
>  	m = rte_ring_dequeue_zc_bulk_start(r, n, &zcd, avail);
> -	n = (m == n) ? n : 0;
> -	if (n != 0) {
> +	if (m != 0) {
>  		/* Copy the data from the ring */
>  		test_ring_copy_from(&zcd, obj, -1, n);
>  		rte_ring_dequeue_zc_finish(r, n);
> @@ -32,8 +31,7 @@ _st_ring_enqueue_bulk(struct rte_ring *r, void * const
> *obj, uint32_t n,
>  	struct rte_ring_zc_data zcd;
> 
>  	m = rte_ring_enqueue_zc_bulk_start(r, n, &zcd, free);
> -	n = (m == n) ? n : 0;
> -	if (n != 0) {
> +	if (m != 0) {
>  		/* Copy the data from the ring */
>  		test_ring_copy_to(&zcd, obj, -1, n);
>  		rte_ring_enqueue_zc_finish(r, n);
> --
> 2.25.1



More information about the dev mailing list