From mboxrd@z Thu Jan 1 00:00:00 1970 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) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 03 Feb 2016 19:35:55 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,393,1449561600"; d="scan'208";a="876588565" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga001.jf.intel.com with ESMTP; 03 Feb 2016 19:35:55 -0800 Received: from fmsmsx155.amr.corp.intel.com (10.18.116.71) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 3 Feb 2016 19:35:54 -0800 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by FMSMSX155.amr.corp.intel.com (10.18.116.71) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 3 Feb 2016 19:35:54 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.218]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.117]) with mapi id 14.03.0248.002; Thu, 4 Feb 2016 11:35:53 +0800 From: "Wang, Zhihong" To: Thomas Monjalon , "dev@dpdk.org" Thread-Topic: [PATCH 1/3] eal/x86: fix build with clang for old AVX Thread-Index: AQHRXrTSzN3HSx2BV0yBFbNg5kP7H58bN9JQ 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> In-Reply-To: <1454525799-25552-2-git-send-email-thomas.monjalon@6wind.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZmU2MWY4M2QtMWYyZi00MmNhLTg2MGItMGU2ZGI0OTFhNTQzIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjQuMTAuMTkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiQWJWdUtKdHdjTFF1aVlRZlpWdnpJNlFCSGRmSmk3TlwvNnM1K0V3dklYTUU9In0= 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 1/3] eal/x86: fix build with clang for old AVX 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, 04 Feb 2016 03:35:56 -0000 > 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