From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 11DF14284B; Mon, 27 Mar 2023 16:34:41 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CBBAA41140; Mon, 27 Mar 2023 16:34:40 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id E809A41140; Mon, 27 Mar 2023 16:34:39 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 385D520FD8A2; Mon, 27 Mar 2023 07:34:39 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 385D520FD8A2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1679927679; bh=EY1QQZ1AAk6369e3hLGEMXNu4EjoUUFk9b3qY9m1nc8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=dzBCD9h2KtXcQLBJVNYchGkurJp2FUyW74V0RncDS0k//21JRgg9za2NDhqWnBF/c vRKHWYuHsrgBy99AsipCK/Mf2j0V5xIqFPnswXlJ3KgXJkbMhcc7wCmiC0pkBvCmUl do5TamnNBnRi9nquoOaFsGTdMAILpB3qiCMQmUaM= Date: Mon, 27 Mar 2023 07:34:39 -0700 From: Tyler Retzlaff To: Joyce Kong Cc: reshma.pattan@intel.com, stephen@networkplumber.org, konstantin.v.ananyev@yandex.ru, dev@dpdk.org, nd@arm.com, stable@dpdk.org, Ruifeng Wang Subject: Re: [PATCH] pdump: fix build issue with GCC 12 Message-ID: <20230327143439.GB26463@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <20230327070712.280265-1-joyce.kong@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230327070712.280265-1-joyce.kong@arm.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Mon, Mar 27, 2023 at 07:07:12AM +0000, Joyce Kong wrote: > The following warning is observed with GCC12 compilation > with release 20.11: > > In function ‘__rte_ring_enqueue_elems_64’, > inlined from ‘__rte_ring_enqueue_elems’ at > ../lib/librte_ring/rte_ring_elem.h:225:3, > inlined from ‘__rte_ring_do_enqueue_elem’ at > ../lib/librte_ring/rte_ring_elem.h:424:2, > inlined from ‘rte_ring_mp_enqueue_burst_elem’ at > ../lib/librte_ring/rte_ring_elem.h:884:9, > inlined from ‘rte_ring_enqueue_burst_elem’ at > ../lib/librte_ring/rte_ring_elem.h:946:10, > inlined from ‘rte_ring_enqueue_burst’ at > ../lib/librte_ring/rte_ring.h:721:9, > inlined from ‘pdump_copy’ at > ../lib/librte_pdump/rte_pdump.c:94:13: > ../lib/librte_ring/rte_ring_elem.h:162:40: warning: ‘*dup_bufs.36_42 > + _89’ may be used uninitialized [-Wmaybe-uninitialized] > 162 | ring[idx] = obj[i]; > | ~~~^~~ > ../lib/librte_ring/rte_ring_elem.h:163:44: warning: ‘*dup_bufs.36_42 > + _98’ may be used uninitialized [-Wmaybe-uninitialized] > 163 | ring[idx + 1] = obj[i + 1]; > | ~~~^~~~~~~ > ../lib/librte_ring/rte_ring_elem.h:164:44: warning: ‘*dup_bufs.36_42 > + _107’ may be used uninitialized [-Wmaybe-uninitialized] > 164 | ring[idx + 2] = obj[i + 2]; > | ~~~^~~~~~~ > ../lib/librte_ring/rte_ring_elem.h:165:44: warning: ‘*dup_bufs.36_42 > + _116’ may be used uninitialized [-Wmaybe-uninitialized] > 165 | ring[idx + 3] = obj[i + 3]; > | ~~~^~~~~~~ > ../lib/librte_ring/rte_ring_elem.h:169:42: warning: ‘*dup_bufs.36_42 > + _129’ may be used uninitialized [-Wmaybe-uninitialized] > 169 | ring[idx++] = obj[i++]; /* fallthrough */ > | ~~~^~~~~ > ../lib/librte_ring/rte_ring_elem.h:171:42: warning: ‘*dup_bufs.36_42 > + _139’ may be used uninitialized [-Wmaybe-uninitialized] > 171 | ring[idx++] = obj[i++]; /* fallthrough */ > | ~~~^~~~~ > ../lib/librte_ring/rte_ring_elem.h:173:42: warning: ‘*dup_bufs.36_42 > + _149’ may be used uninitialized [-Wmaybe-uninitialized] > 173 | ring[idx++] = obj[i++]; > > Actually, this is an alias warning as -O3 enables strict alias. > This patch fixes it by replacing 'dup_bufs' with '&dup_bufs[0]' > as the compiler represents them differently. > > Fixes: 278f945402c5 ("pdump: add new library for packet capture") > Cc: stable@dpdk.org > > Signed-off-by: Joyce Kong > Reviewed-by: Ruifeng Wang > --- Acked-by: Tyler Retzlaff > lib/pdump/rte_pdump.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/lib/pdump/rte_pdump.c b/lib/pdump/rte_pdump.c > index 9bc4bab4f2..53cca1034d 100644 > --- a/lib/pdump/rte_pdump.c > +++ b/lib/pdump/rte_pdump.c > @@ -134,7 +134,7 @@ pdump_copy(uint16_t port_id, uint16_t queue, > > __atomic_fetch_add(&stats->accepted, d_pkts, __ATOMIC_RELAXED); > > - ring_enq = rte_ring_enqueue_burst(ring, (void *)dup_bufs, d_pkts, NULL); > + ring_enq = rte_ring_enqueue_burst(ring, (void *)&dup_bufs[0], d_pkts, NULL); nit: i would drop the cast to void *, it shouldn't be needed?