From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 14559A0526; Tue, 10 Nov 2020 12:03:24 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E3762F90; Tue, 10 Nov 2020 12:03:21 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 6DC5F2AB for ; Tue, 10 Nov 2020 12:03:19 +0100 (CET) IronPort-SDR: fwoJLEJjWY6Zn1DvQMkSgedTZw5RJ7LGZpcElISbRTPVS2JakL9DfoK0WQz/KQ1pgowlBSLHlF xY0uKE934GBw== X-IronPort-AV: E=McAfee;i="6000,8403,9800"; a="156961142" X-IronPort-AV: E=Sophos;i="5.77,466,1596524400"; d="scan'208";a="156961142" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Nov 2020 03:03:17 -0800 IronPort-SDR: XPZLpl+UD9VHBOkPEOBOoHETzJXBUwrVIRXQBPPnvVoOopuP2m6F2L1ixZ36kAaz2+9U7RE3fr le0ZToaI2ESg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,466,1596524400"; d="scan'208";a="356096678" Received: from silpixa00400466.ir.intel.com ([10.237.213.98]) by fmsmga004.fm.intel.com with ESMTP; 10 Nov 2020 03:03:15 -0800 From: Conor Walsh To: honnappa.nagarahalli@arm.com, konstantin.ananyev@intel.com Cc: dev@dpdk.org, linglix.chen@intel.com, Conor Walsh Date: Tue, 10 Nov 2020 11:03:13 +0000 Message-Id: <20201110110313.1924365-1-conor.walsh@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201104170306.1688771-1-conor.walsh@intel.com> References: <20201104170306.1688771-1-conor.walsh@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2] app/test: fix to prevent zcd gcc compile error X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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