DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Wang, Zhihong" <zhihong.wang@intel.com>
To: "Wodkowski, PawelX" <pawelx.wodkowski@intel.com>,
	"Richardson, Bruce" <bruce.richardson@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] A fix to work around strict-aliasing rules breaking
Date: Wed, 4 Mar 2015 05:57:36 +0000	[thread overview]
Message-ID: <F60F360A2500CD45ACDB1D700268892D0E790F62@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <54F4584B.5090507@intel.com>



> -----Original Message-----
> From: Wodkowski, PawelX
> Sent: Monday, March 02, 2015 8:32 PM
> To: Richardson, Bruce; Wang, Zhihong
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] A fix to work around strict-aliasing rules
> breaking
> 
> 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 <zhihong.wang@intel.com>
> >> ---
> >>   .../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,

Thanks for the suggestion! But I don't think union can work around this --- already tried in CentOS release 6.5.
Anyway this is for compiler ethics only, the assembly code generated will be the same no matter what kind of method is used.

Zhihong (John)

> 
> --
> Pawel

  reply	other threads:[~2015-03-04  5:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-02  9:03 zhihong.wang
2015-03-02 10:32 ` Bruce Richardson
2015-03-02 12:32   ` Pawel Wodkowski
2015-03-04  5:57     ` Wang, Zhihong [this message]
2015-03-04  2:07   ` Wang, Zhihong
2015-03-04 10:18     ` Bruce Richardson
2015-03-05 17:33 ` Thomas Monjalon
2015-03-06  7:36 ` Liang, Cunming
2015-03-09 11:44   ` Thomas Monjalon
2015-03-09  6:14 ` Qiu, Michael

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=F60F360A2500CD45ACDB1D700268892D0E790F62@SHSMSX101.ccr.corp.intel.com \
    --to=zhihong.wang@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=pawelx.wodkowski@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).