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 19D08A00C5; Thu, 25 Aug 2022 09:21:06 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 085E240DFD; Thu, 25 Aug 2022 09:21:06 +0200 (CEST) Received: from smartserver.smartsharesystems.com (smartserver.smartsharesystems.com [77.243.40.215]) by mails.dpdk.org (Postfix) with ESMTP id 2852E40156; Thu, 25 Aug 2022 09:21:05 +0200 (CEST) Content-class: urn:content-classes:message Subject: RE: [PATCH 1/2] net/i40e: compilation fix for GCC-12 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Date: Thu, 25 Aug 2022 09:21:03 +0200 Message-ID: <98CBD80474FA8B44BF855DF32C47DC35D872AA@smartserver.smartshare.dk> X-MimeOLE: Produced By Microsoft Exchange V6.5 In-Reply-To: <20220824140339.2581716-1-amitprakashs@marvell.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PATCH 1/2] net/i40e: compilation fix for GCC-12 Thread-Index: Adi3wlfwz9J8bIDhRWmlqM9iJgIOmQAkIYCg References: <20220823105742.2276506-1-amitprakashs@marvell.com> <20220824140339.2581716-1-amitprakashs@marvell.com> From: =?iso-8859-1?Q?Morten_Br=F8rup?= To: "Amit Prakash Shukla" , "Yuying Zhang" , "Beilei Xing" Cc: , , 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 > From: Amit Prakash Shukla [mailto:amitprakashs@marvell.com] > Sent: Wednesday, 24 August 2022 16.04 >=20 > GCC 12 raises the following warning: >=20 > meson --werror --buildtype=3Ddebugoptimized > --cross-file config/x86/cross-mingw -Dexamples=3Dhelloworld build > ninja -C build >=20 > In function 'i40e_hash_get_pattern_type', > inlined from 'i40e_hash_get_pattern_pctypes' at > ../drivers/net/i40e/i40e_hash.c:520:8, > inlined from 'i40e_hash_parse_pattern_act' at > ../drivers/net/i40e/i40e_hash.c:1147:9, > inlined from 'i40e_hash_parse' at > ../drivers/net/i40e/i40e_hash.c:1181:9: > ../drivers/net/i40e/i40e_hash.c:389:47: > error: array subscript 53 is above array > bounds of 'const uint64_t[53]' > {aka 'const long long unsigned int[53]'} [-Werror=3Darray-bounds] > 389 | item_hdr =3D = pattern_item_header[last_item_type]; > | ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~ > ../drivers/net/i40e/i40e_hash.c: In function 'i40e_hash_parse': > ../drivers/net/i40e/i40e_hash.c:182:23: note: while referencing > 'pattern_item_header' > 182 | static const uint64_t pattern_item_header[] =3D { > | ^~~~~~~~~~~~~~~~~~~ > cc1: all warnings being treated as errors >=20 > Fixes: ef4c16fd9148 (net/i40e: refactor RSS flow) > Cc: stable@dpdk.org >=20 > Signed-off-by: Amit Prakash Shukla > --- > v2: > - Removed "examples/ipsec-secgw" patch from this series and posted it > as > seperate patch. >=20 > drivers/net/i40e/i40e_hash.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/net/i40e/i40e_hash.c > b/drivers/net/i40e/i40e_hash.c > index 8962e9d97a..a1ff85fceb 100644 > --- a/drivers/net/i40e/i40e_hash.c > +++ b/drivers/net/i40e/i40e_hash.c > @@ -384,8 +384,10 @@ i40e_hash_get_pattern_type(const struct > rte_flow_item pattern[], > } >=20 > prev_item_type =3D last_item_type; > - assert(last_item_type < (enum rte_flow_item_type) > - RTE_DIM(pattern_item_header)); > + if (last_item_type >=3D (enum rte_flow_item_type) > + RTE_DIM(pattern_item_header)) Does this compile with the correct static branch prediction? If not, = please add unlikely() to error checks like this. > + goto not_sup; > + > item_hdr =3D pattern_item_header[last_item_type]; > assert(item_hdr); >=20 > -- > 2.25.1 >=20