From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id CB91AA0350;
	Mon, 11 May 2020 18:07:55 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id AE9C91C133;
	Mon, 11 May 2020 18:07:48 +0200 (CEST)
Received: from mga02.intel.com (mga02.intel.com [134.134.136.20])
 by dpdk.org (Postfix) with ESMTP id C0B781C10B
 for <dev@dpdk.org>; Mon, 11 May 2020 18:07:45 +0200 (CEST)
IronPort-SDR: M9JNSfpVGwvH1EyLdAGSzArdtanvwc0yr4ie2sOF9nE2VKjyWAAgkk7mr8yUYqfRIv3ER0WTxb
 hhkEe7rZ7tsg==
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from orsmga006.jf.intel.com ([10.7.209.51])
 by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 11 May 2020 09:07:32 -0700
IronPort-SDR: 20FPClGqUi74dveU6aBq/6zDFxecmxJAW0ZPOB+zdf50YpUr0I67uBlFmQ0/Qu1IqyNlQjg9Z3
 4HyYcRqxAvGA==
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.73,380,1583222400"; d="scan'208";a="265201382"
Received: from silpixa00399752.ir.intel.com (HELO
 silpixa00399752.ger.corp.intel.com) ([10.237.222.180])
 by orsmga006.jf.intel.com with ESMTP; 11 May 2020 09:07:30 -0700
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Jerin Jacob <jerinj@marvell.com>,
 Nithin Dabilpuram <ndabilpuram@marvell.com>
Cc: dev@dpdk.org, Ferruh Yigit <ferruh.yigit@intel.com>,
 Thomas Monjalon <thomas@monjalon.net>,
 David Marchand <david.marchand@redhat.com>
Date: Mon, 11 May 2020 17:07:23 +0100
Message-Id: <20200511160725.1497902-2-ferruh.yigit@intel.com>
X-Mailer: git-send-email 2.25.4
In-Reply-To: <20200511160725.1497902-1-ferruh.yigit@intel.com>
References: <20200507120259.2197813-1-ferruh.yigit@intel.com>
 <20200511160725.1497902-1-ferruh.yigit@intel.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Subject: [dpdk-dev] [PATCH v3 2/4] mempool/octeontx2: fix build for gcc O1
	optimization
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

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

Build error:
In file included from .../drivers/mempool/octeontx2/otx2_mempool.h:13,
                from .../drivers/mempool/octeontx2/otx2_mempool_ops.c:8:
.../drivers/mempool/octeontx2/otx2_mempool_ops.c:
	In function ‘otx2_npa_alloc’:
.../drivers/common/octeontx2/otx2_common.h:94:2:
    error: ‘aura_handle’ may be used uninitialized in this function
           [-Werror=maybe-uninitialized]
   94 |  rte_log(RTE_LOG_DEBUG, otx2_logtype_ ## subsystem,  \
      |  ^~~~~~~
.../drivers/mempool/octeontx2/otx2_mempool_ops.c:643:11:
    note: ‘aura_handle’ was declared here
  643 |  uint64_t aura_handle;
      |           ^~~~~~~~~~~

This looks like false positive, assigning an initial value to
'aura_handle' to fix the build error.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>

---
This is assuming assigning initial value won't have a performance affect
if it does, we need to find another fix.
And overall not sure why this false positive warning is generated.
---
 drivers/mempool/octeontx2/otx2_mempool_ops.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mempool/octeontx2/otx2_mempool_ops.c b/drivers/mempool/octeontx2/otx2_mempool_ops.c
index 162b7f01da..a14c9c5e94 100644
--- a/drivers/mempool/octeontx2/otx2_mempool_ops.c
+++ b/drivers/mempool/octeontx2/otx2_mempool_ops.c
@@ -637,10 +637,10 @@ static int
 otx2_npa_alloc(struct rte_mempool *mp)
 {
 	uint32_t block_size, block_count;
+	uint64_t aura_handle = 0;
 	struct otx2_npa_lf *lf;
 	struct npa_aura_s aura;
 	struct npa_pool_s pool;
-	uint64_t aura_handle;
 	size_t padding;
 	int rc;
 
-- 
2.25.4