From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 762115A74 for ; Thu, 5 Mar 2015 09:25:55 +0100 (CET) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 05 Mar 2015 00:25:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,345,1422950400"; d="scan'208";a="675469389" Received: from pgsmsx108.gar.corp.intel.com ([10.221.44.103]) by fmsmga001.fm.intel.com with ESMTP; 05 Mar 2015 00:25:53 -0800 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by PGSMSX108.gar.corp.intel.com (10.221.44.103) with Microsoft SMTP Server (TLS) id 14.3.195.1; Thu, 5 Mar 2015 16:25:42 +0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.197]) by shsmsx102.ccr.corp.intel.com ([169.254.2.62]) with mapi id 14.03.0195.001; Thu, 5 Mar 2015 16:25:41 +0800 From: "Tang, HaifengX" To: "Qiu, Michael" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v3] librte_eal/common: Fix cast from pointer to integer of different size Thread-Index: AQHQVxikXXINhCYs60mGcvIRrQ7TJZ0Ni2FA Date: Thu, 5 Mar 2015 08:25:40 +0000 Message-ID: References: <1425281223-14043-1-git-send-email-michael.qiu@intel.com> <1425541598-8669-1-git-send-email-michael.qiu@intel.com> In-Reply-To: <1425541598-8669-1-git-send-email-michael.qiu@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v3] librte_eal/common: Fix cast from pointer to integer of different size X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Mar 2015 08:25:56 -0000 Tested-by: haifeng.tang Patch name: [dpdk-dev] [PATCH v3] librte_eal/common: Fix cast from pointer = to integer of different size Test Env : Fedora 18 , 3.6.10-4 ,4.7.2 ,14.0.0 Fedora20 ,3.11.0,4.8.2,14.0.0 Fedora21,3.17.4-302,4.9.2,15.0.0 Ubuntu 14.04, 3.13.0-30, 4.8.2, 14.0.0 Test Result: error: cast from pointer to integer of different size [-Werror=3Dpointer-to= -int-cast] problem fixed now -----Original Message----- From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Michael Qiu Sent: Thursday, March 05, 2015 3:47 PM To: dev@dpdk.org Subject: [dpdk-dev] [PATCH v3] librte_eal/common: Fix cast from pointer to = integer of different size ./i686-native-linuxapp-gcc/include/rte_memcpy.h:592:23: error: cast from pointer to integer of different size [-Werror=3Dpointer-to-int-ca= st] dstofss =3D 16 - (int)((long long)(void *)dst & 0x0F) + 16; Type 'long long' is 64-bit in i686 platform while 'void *' is 32-bit. Signed-off-by: Michael Qiu --- v3 --> v2: make dstofss and srcofs to be type size_t casting type use uintptr_t v2 --> v1: Remove unnecessary casting (void *) lib/librte_eal/common/include/arch/x86/rte_memcpy.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/librte_eal/common/include/arch/x86/rte_memcpy.h b/lib/libr= te_eal/common/include/arch/x86/rte_memcpy.h index 7b2d382..aa433e4 100644 --- a/lib/librte_eal/common/include/arch/x86/rte_memcpy.h +++ b/lib/librte_eal/common/include/arch/x86/rte_memcpy.h @@ -493,8 +493,8 @@ rte_memcpy(void *dst, const void *src, size_t n) { __m128i xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8; void *ret =3D dst; - int dstofss; - int srcofs; + size_t dstofss; + size_t srcofs; =20 /** * Copy less than 16 bytes @@ -589,12 +589,12 @@ COPY_BLOCK_64_BACK15: * unaligned copy functions require up to 15 bytes * backwards access. */ - dstofss =3D 16 - (int)((long long)(void *)dst & 0x0F) + 16; + dstofss =3D 16 - ((uintptr_t)dst & 0x0F) + 16; n -=3D dstofss; rte_mov32((uint8_t *)dst, (const uint8_t *)src); src =3D (const uint8_t *)src + dstofss; dst =3D (uint8_t *)dst + dstofss; - srcofs =3D (int)((long long)(const void *)src & 0x0F); + srcofs =3D (uintptr_t)src & 0x0F; =20 /** * For aligned copy -- 1.9.3