From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 86F31595A for ; Mon, 2 Mar 2015 13:32:36 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP; 02 Mar 2015 04:32:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,675,1418112000"; d="scan'208";a="692663804" Received: from unknown (HELO [10.217.248.122]) ([10.217.248.122]) by orsmga002.jf.intel.com with ESMTP; 02 Mar 2015 04:32:34 -0800 Message-ID: <54F4584B.5090507@intel.com> Date: Mon, 02 Mar 2015 13:32:11 +0100 From: Pawel Wodkowski User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Bruce Richardson , zhihong.wang@intel.com References: <1425287030-18225-1-git-send-email-zhihong.wang@intel.com> <20150302103224.GC8520@bricha3-MOBL3> In-Reply-To: <20150302103224.GC8520@bricha3-MOBL3> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH] A fix to work around strict-aliasing rules breaking 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: Mon, 02 Mar 2015 12:32:37 -0000 On 2015-03-02 11:32, Bruce Richardson wrote: > On Mon, Mar 02, 2015 at 05:03:50PM +0800, zhihong.wang@intel.com wrote: >> Fixed strict-aliasing rules breaking errors for some GCC version. >> > > This looks messy. Also, I believe the definition of memcpy should include > the "restrict" keyword to indicate that source and dest can't overlap. Might > that help fix the issue? > Is this error related with overlapping or casting 'void *' to 'uintXX_t *' that make compiler report aliasing rule breaking? > >> Signed-off-by: Zhihong Wang >> --- >> .../common/include/arch/x86/rte_memcpy.h | 44 ++++++++++++---------- >> 1 file changed, 24 insertions(+), 20 deletions(-) >> >> diff --git a/lib/librte_eal/common/include/arch/x86/rte_memcpy.h b/lib/librte_eal/common/include/arch/x86/rte_memcpy.h >> index 69a5c6f..f412099 100644 >> --- a/lib/librte_eal/common/include/arch/x86/rte_memcpy.h >> +++ b/lib/librte_eal/common/include/arch/x86/rte_memcpy.h >> @@ -195,6 +195,8 @@ rte_mov256blocks(uint8_t *dst, const uint8_t *src, size_t n) >> static inline void * >> rte_memcpy(void *dst, const void *src, size_t n) >> { >> + uintptr_t dstu = (uintptr_t)dst; >> + uintptr_t srcu = (uintptr_t)src; If so maybe using union here would be good solution or 'char *'. -- Pawel