From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Wang, Zhihong" Subject: Re: [PATCH 1/3] eal/x86: fix build with clang for old AVX Date: Thu, 4 Feb 2016 03:35:53 +0000 Message-ID: <8F6C2BD409508844A0EFC19955BE0941033ACABA@SHSMSX103.ccr.corp.intel.com> References: <1454525799-25552-1-git-send-email-thomas.monjalon@6wind.com> <1454525799-25552-2-git-send-email-thomas.monjalon@6wind.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable To: Thomas Monjalon , "dev@dpdk.org" Return-path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 5A7DC8D90 for ; Thu, 4 Feb 2016 04:35:56 +0100 (CET) In-Reply-To: <1454525799-25552-2-git-send-email-thomas.monjalon@6wind.com> Content-Language: en-US List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > Subject: [PATCH 1/3] eal/x86: fix build with clang for old AVX >=20 > When configuring RTE_MACHINE to "default", rte_memcpy implementation > is the default one (old AVX). > In this code, clang raises a warning thanks to -Wsometimes-uninitialized: >=20 > rte_memcpy.h:838:6: error: > variable 'srcofs' is used uninitialized whenever 'if' condition is false > if (dstofss > 0) { > ^~~~~~~~~~~ > rte_memcpy.h:849:6: note: uninitialized use occurs here > if (srcofs =3D=3D 0) { > ^~~~~~ >=20 > It is fixed by initializing srcofs to 0. >=20 > Fixes: 1ae817f9f887 ("eal/x86: tune memcpy for platforms without AVX512") >=20 > Signed-off-by: Thomas Monjalon > --- > lib/librte_eal/common/include/arch/x86/rte_memcpy.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Hi Thomas, Thanks for pointing this out! My last hasty modification on this is not correct. The patch below will fix it. All modifications are tested. Sorry for all the hassle! :'( "srcofs" should be calculated based on source address anyway. --- a/lib/librte_eal/common/include/arch/x86/rte_memcpy.h +++ b/lib/librte_eal/common/include/arch/x86/rte_memcpy.h @@ -512,8 +512,9 @@ COPY_BLOCK_64_BACK31: /** * Make store aligned when copy size exceeds 512 bytes */ - dstofss =3D 32 - ((uintptr_t)dst & 0x1F); + dstofss =3D (uintptr_t)dst & 0x1F; if (dstofss > 0) { + dstofss =3D 32 - dstofss; n -=3D dstofss; rte_mov32((uint8_t *)dst, (const uint8_t *)src); src =3D (const uint8_t *)src + dstofss; @@ -834,14 +835,15 @@ COPY_BLOCK_64_BACK15: * unaligned copy functions require up to 15 bytes * backwards access. */ - dstofss =3D 16 - ((uintptr_t)dst & 0x0F) + 16; + dstofss =3D (uintptr_t)dst & 0x0F; if (dstofss > 0) { + dstofss =3D 16 - dstofss + 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 ((uintptr_t)src & 0x0F); } + srcofs =3D ((uintptr_t)src & 0x0F); =20 /** * For aligned copy