From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Yubin Ruan <ablacktshirt@gmail.com>
Cc: perfbook@vger.kernel.org
Subject: Re: Invalid compilation without -fno-strict-aliasing
Date: Fri, 3 Nov 2017 05:27:19 -0700 [thread overview]
Message-ID: <20171103122719.GH3624@linux.vnet.ibm.com> (raw)
In-Reply-To: <CAJYFCiOuj6O18jBM=tWX6wxhXi4sskV-2WYYPvGLgU6LS3aH4w@mail.gmail.com>
On Fri, Nov 03, 2017 at 09:54:15AM +0800, Yubin Ruan wrote:
> Does anyone have any idea why this thread
>
> https://lkml.org/lkml/2003/2/25/270
Hmmm... This is quite the blast from the past. Compilers have changed
a bit in the last 14 years. Nevertheles...
> is related to strict-aliasing? To me, a compiler barrier like this will fix it:
>
> if((stream + event_len) < ends) {
> iwe->len = event_len;
> barrier();
> memcpy(stream, (char *) iwe, event_len);
> stream += event_len;
> }
As with many bugs, there are a number of ways to fix this one. I suggest taking
a look at the documentation for -no-strict-alias. This stackoverflow URL might
not be a bad place to start:
https://stackoverflow.com/questions/23848188/strict-aliasing-rule-and-char-pointers
Thanx, Paul
next prev parent reply other threads:[~2017-11-03 12:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-03 1:54 Invalid compilation without -fno-strict-aliasing Yubin Ruan
2017-11-03 12:27 ` Paul E. McKenney [this message]
2017-11-03 13:33 ` Yubin Ruan
2017-11-03 14:03 ` Paul E. McKenney
2017-11-03 14:12 ` Yubin Ruan
2017-11-03 14:38 ` Paul E. McKenney
2017-11-03 23:26 ` Yubin Ruan
2017-11-03 23:55 ` Paul E. McKenney
2017-11-04 0:24 ` Yubin Ruan
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=20171103122719.GH3624@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=ablacktshirt@gmail.com \
--cc=perfbook@vger.kernel.org \
/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