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 24E22432D1; Wed, 8 Nov 2023 09:47:24 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 86F5A42DF6; Wed, 8 Nov 2023 09:47:23 +0100 (CET) Received: from dkmailrelay1.smartsharesystems.com (smartserver.smartsharesystems.com [77.243.40.215]) by mails.dpdk.org (Postfix) with ESMTP id 547B8402B5; Wed, 8 Nov 2023 09:47:22 +0100 (CET) Received: from smartserver.smartsharesystems.com (smartserver.smartsharesys.local [192.168.4.10]) by dkmailrelay1.smartsharesystems.com (Postfix) with ESMTP id 3010C200F4; Wed, 8 Nov 2023 09:47:22 +0100 (CET) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: CI test system not catching truncation bugs for 32-bit architectures? X-MimeOLE: Produced By Microsoft Exchange V6.5 Date: Wed, 8 Nov 2023 09:47:20 +0100 Message-ID: <98CBD80474FA8B44BF855DF32C47DC35E9EFF1@smartserver.smartshare.dk> In-Reply-To: <1699400300-22545-8-git-send-email-roretzla@linux.microsoft.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: CI test system not catching truncation bugs for 32-bit architectures? Thread-Index: AdoR04AVSSKYx3mFRxikPXfMT1CcPQASxv3A References: <1698887132-5347-1-git-send-email-roretzla@linux.microsoft.com> <1699400300-22545-1-git-send-email-roretzla@linux.microsoft.com> <1699400300-22545-8-git-send-email-roretzla@linux.microsoft.com> From: =?iso-8859-1?Q?Morten_Br=F8rup?= To: , Cc: "Bruce Richardson" , "Cristian Dumitrescu" , "David Hunt" , "Honnappa Nagarahalli" , "Ruifeng Wang" , "Sameh Gobriel" , "Vladimir Medvedkin" , "Yipeng Wang" , "Tyler Retzlaff" 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: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com] > Sent: Wednesday, 8 November 2023 00.38 >=20 > Use rte_popcount64 instead of __builtin_popcountl where the argument > type passed to the intrinsic was 64-bits. Can someone please explain why our CI test system accepted passing a = 64-bit value to __builtin_popcountl(unsigned long) when building for = 32-bit architectures, where an unsigned long is 32 bit? The 32 most = significant bits were blindly truncated here. It looks like this patch also fixes a bug (which should have been caught = by the CI system) for 32-bit architectures. >=20 > Signed-off-by: Tyler Retzlaff > --- > lib/hash/rte_cuckoo_hash.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/lib/hash/rte_cuckoo_hash.c b/lib/hash/rte_cuckoo_hash.c > index 19ee53a..ccdc3b9 100644 > --- a/lib/hash/rte_cuckoo_hash.c > +++ b/lib/hash/rte_cuckoo_hash.c > @@ -2357,7 +2357,7 @@ struct rte_hash * > __rte_hash_lookup_bulk(h, keys, num_keys, positions, hit_mask, > data); >=20 > /* Return number of hits */ > - return __builtin_popcountl(*hit_mask); > + return rte_popcount64(*hit_mask); > } >=20 >=20 > @@ -2474,7 +2474,7 @@ struct rte_hash * > positions, hit_mask, data); >=20 > /* Return number of hits */ > - return __builtin_popcountl(*hit_mask); > + return rte_popcount64(*hit_mask); > } >=20 > int32_t > -- > 1.8.3.1