All of lore.kernel.org
 help / color / mirror / Atom feed
* next-20151007 perf build error "tools/include/linux/compiler.h:66: error: dereferencing pointer ‘res.41’ does break strict-aliasing rules"
@ 2015-10-07 18:28 Vinson Lee
  2015-10-07 18:47 ` Arnaldo Carvalho de Melo
  2015-10-08  9:12 ` Jiri Olsa
  0 siblings, 2 replies; 7+ messages in thread
From: Vinson Lee @ 2015-10-07 18:28 UTC (permalink / raw)
  To: linux-next, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Andi Kleen, Adrian Hunter, Jiri Olsa,
	Rabin Vincent, Martin Liška

Hi.

I hit this perf build error with next-20151007 with GCC 4.4.

  CC       util/annotate.o
cc1: warnings being treated as errors
util/annotate.c: In function ‘disasm__purge’:
linux-next/tools/include/linux/compiler.h:66: error: dereferencing
pointer ‘res.41’ does break strict-aliasing rules
linux-next/tools/include/linux/compiler.h:66: note: initialized from here
util/annotate.c: In function ‘symbol__annotate’:
linux-next/tools/include/linux/compiler.h:66: error: dereferencing
pointer ‘res.41’ does break strict-aliasing rules
linux-next/tools/include/linux/compiler.h:66: note: initialized from here
linux-next/tools/include/linux/compiler.h:52: error: dereferencing
pointer ‘res.32’ does break strict-aliasing rules
linux-next/tools/include/linux/compiler.h:52: note: initialized from here

Cheers,
Vinson

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: next-20151007 perf build error "tools/include/linux/compiler.h:66: error: dereferencing pointer ‘res.41’ does break strict-aliasing rules"
  2015-10-07 18:28 next-20151007 perf build error "tools/include/linux/compiler.h:66: error: dereferencing pointer ‘res.41’ does break strict-aliasing rules" Vinson Lee
@ 2015-10-07 18:47 ` Arnaldo Carvalho de Melo
  2015-10-08  9:12 ` Jiri Olsa
  1 sibling, 0 replies; 7+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-10-07 18:47 UTC (permalink / raw)
  To: Vinson Lee
  Cc: linux-next, Peter Zijlstra, Ingo Molnar, Andi Kleen,
	Adrian Hunter, Jiri Olsa, Rabin Vincent, Martin Liška

Em Wed, Oct 07, 2015 at 11:28:26AM -0700, Vinson Lee escreveu:
> Hi.
> 
> I hit this perf build error with next-20151007 with GCC 4.4.

Will check.
 
>   CC       util/annotate.o
> cc1: warnings being treated as errors
> util/annotate.c: In function ‘disasm__purge’:
> linux-next/tools/include/linux/compiler.h:66: error: dereferencing
> pointer ‘res.41’ does break strict-aliasing rules
> linux-next/tools/include/linux/compiler.h:66: note: initialized from here
> util/annotate.c: In function ‘symbol__annotate’:
> linux-next/tools/include/linux/compiler.h:66: error: dereferencing
> pointer ‘res.41’ does break strict-aliasing rules
> linux-next/tools/include/linux/compiler.h:66: note: initialized from here
> linux-next/tools/include/linux/compiler.h:52: error: dereferencing
> pointer ‘res.32’ does break strict-aliasing rules
> linux-next/tools/include/linux/compiler.h:52: note: initialized from here
> 
> Cheers,
> Vinson

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: next-20151007 perf build error "tools/include/linux/compiler.h:66: error: dereferencing pointer ‘res.41’ does break strict-aliasing rules"
  2015-10-07 18:28 next-20151007 perf build error "tools/include/linux/compiler.h:66: error: dereferencing pointer ‘res.41’ does break strict-aliasing rules" Vinson Lee
  2015-10-07 18:47 ` Arnaldo Carvalho de Melo
@ 2015-10-08  9:12 ` Jiri Olsa
  2015-10-13  0:48   ` Vinson Lee
  1 sibling, 1 reply; 7+ messages in thread
From: Jiri Olsa @ 2015-10-08  9:12 UTC (permalink / raw)
  To: Vinson Lee
  Cc: linux-next, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Andi Kleen, Adrian Hunter, Jiri Olsa,
	Rabin Vincent, Martin Liška

On Wed, Oct 07, 2015 at 11:28:26AM -0700, Vinson Lee wrote:
> Hi.
> 
> I hit this perf build error with next-20151007 with GCC 4.4.
> 
>   CC       util/annotate.o
> cc1: warnings being treated as errors
> util/annotate.c: In function ‘disasm__purge’:
> linux-next/tools/include/linux/compiler.h:66: error: dereferencing
> pointer ‘res.41’ does break strict-aliasing rules
> linux-next/tools/include/linux/compiler.h:66: note: initialized from here
> util/annotate.c: In function ‘symbol__annotate’:
> linux-next/tools/include/linux/compiler.h:66: error: dereferencing
> pointer ‘res.41’ does break strict-aliasing rules
> linux-next/tools/include/linux/compiler.h:66: note: initialized from here
> linux-next/tools/include/linux/compiler.h:52: error: dereferencing
> pointer ‘res.32’ does break strict-aliasing rules
> linux-next/tools/include/linux/compiler.h:52: note: initialized from here
> 
> Cheers,
> Vinson

we took this stuff from kernel, which is built with -fno-strict-aliasing
which we use -Wstrict-aliasing=3

we need something like below defined for all the types, but I'm still
hoping for some nicer solution.. however patch below fixed the build
for me.. could you please test?

thanks,
jirka


---
diff --git a/tools/include/linux/compiler.h b/tools/include/linux/compiler.h
index 9098083..0ed624f 100644
--- a/tools/include/linux/compiler.h
+++ b/tools/include/linux/compiler.h
@@ -43,13 +43,18 @@
 
 #include <linux/types.h>
 
+typedef u64 __attribute__((__may_alias__)) u64_alias_t;
+
 static __always_inline void __read_once_size(const volatile void *p, void *res, int size)
 {
+	u64_alias_t *u64_p = (u64_alias_t*) p;
+	u64_alias_t *u64_res = (u64_alias_t*) res;
+
 	switch (size) {
 	case 1: *(__u8 *)res = *(volatile __u8 *)p; break;
 	case 2: *(__u16 *)res = *(volatile __u16 *)p; break;
 	case 4: *(__u32 *)res = *(volatile __u32 *)p; break;
-	case 8: *(__u64 *)res = *(volatile __u64 *)p; break;
+	case 8: *u64_res = *u64_p; break;
 	default:
 		barrier();
 		__builtin_memcpy((void *)res, (const void *)p, size);
@@ -59,11 +64,14 @@ static __always_inline void __read_once_size(const volatile void *p, void *res,
 
 static __always_inline void __write_once_size(volatile void *p, void *res, int size)
 {
+	u64_alias_t *u64_p = (u64_alias_t*) p;
+	u64_alias_t *u64_res = (u64_alias_t*) res;
+
 	switch (size) {
 	case 1: *(volatile __u8 *)p = *(__u8 *)res; break;
 	case 2: *(volatile __u16 *)p = *(__u16 *)res; break;
 	case 4: *(volatile __u32 *)p = *(__u32 *)res; break;
-	case 8: *(volatile __u64 *)p = *(__u64 *)res; break;
+	case 8: *u64_p = *u64_res; break;
 	default:
 		barrier();
 		__builtin_memcpy((void *)p, (const void *)res, size);

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: next-20151007 perf build error "tools/include/linux/compiler.h:66: error: dereferencing pointer ‘res.41’ does break strict-aliasing rules"
  2015-10-08  9:12 ` Jiri Olsa
@ 2015-10-13  0:48   ` Vinson Lee
  2015-10-13  8:52     ` [PATCH] tools include: Fix strict-aliasing rules breakage " Jiri Olsa
  0 siblings, 1 reply; 7+ messages in thread
From: Vinson Lee @ 2015-10-13  0:48 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: linux-next, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Andi Kleen, Adrian Hunter, Jiri Olsa,
	Rabin Vincent, Martin Liška

On Thu, Oct 8, 2015 at 2:12 AM, Jiri Olsa <jolsa@redhat.com> wrote:
> On Wed, Oct 07, 2015 at 11:28:26AM -0700, Vinson Lee wrote:
>> Hi.
>>
>> I hit this perf build error with next-20151007 with GCC 4.4.
>>
>>   CC       util/annotate.o
>> cc1: warnings being treated as errors
>> util/annotate.c: In function ‘disasm__purge’:
>> linux-next/tools/include/linux/compiler.h:66: error: dereferencing
>> pointer ‘res.41’ does break strict-aliasing rules
>> linux-next/tools/include/linux/compiler.h:66: note: initialized from here
>> util/annotate.c: In function ‘symbol__annotate’:
>> linux-next/tools/include/linux/compiler.h:66: error: dereferencing
>> pointer ‘res.41’ does break strict-aliasing rules
>> linux-next/tools/include/linux/compiler.h:66: note: initialized from here
>> linux-next/tools/include/linux/compiler.h:52: error: dereferencing
>> pointer ‘res.32’ does break strict-aliasing rules
>> linux-next/tools/include/linux/compiler.h:52: note: initialized from here
>>
>> Cheers,
>> Vinson
>
> we took this stuff from kernel, which is built with -fno-strict-aliasing
> which we use -Wstrict-aliasing=3
>
> we need something like below defined for all the types, but I'm still
> hoping for some nicer solution.. however patch below fixed the build
> for me.. could you please test?
>
> thanks,
> jirka
>
>
> ---
> diff --git a/tools/include/linux/compiler.h b/tools/include/linux/compiler.h
> index 9098083..0ed624f 100644
> --- a/tools/include/linux/compiler.h
> +++ b/tools/include/linux/compiler.h
> @@ -43,13 +43,18 @@
>
>  #include <linux/types.h>
>
> +typedef u64 __attribute__((__may_alias__)) u64_alias_t;
> +
>  static __always_inline void __read_once_size(const volatile void *p, void *res, int size)
>  {
> +       u64_alias_t *u64_p = (u64_alias_t*) p;
> +       u64_alias_t *u64_res = (u64_alias_t*) res;
> +
>         switch (size) {
>         case 1: *(__u8 *)res = *(volatile __u8 *)p; break;
>         case 2: *(__u16 *)res = *(volatile __u16 *)p; break;
>         case 4: *(__u32 *)res = *(volatile __u32 *)p; break;
> -       case 8: *(__u64 *)res = *(volatile __u64 *)p; break;
> +       case 8: *u64_res = *u64_p; break;
>         default:
>                 barrier();
>                 __builtin_memcpy((void *)res, (const void *)p, size);
> @@ -59,11 +64,14 @@ static __always_inline void __read_once_size(const volatile void *p, void *res,
>
>  static __always_inline void __write_once_size(volatile void *p, void *res, int size)
>  {
> +       u64_alias_t *u64_p = (u64_alias_t*) p;
> +       u64_alias_t *u64_res = (u64_alias_t*) res;
> +
>         switch (size) {
>         case 1: *(volatile __u8 *)p = *(__u8 *)res; break;
>         case 2: *(volatile __u16 *)p = *(__u16 *)res; break;
>         case 4: *(volatile __u32 *)p = *(__u32 *)res; break;
> -       case 8: *(volatile __u64 *)p = *(__u64 *)res; break;
> +       case 8: *u64_p = *u64_res; break;
>         default:
>                 barrier();
>                 __builtin_memcpy((void *)p, (const void *)res, size);


This patch fixes my perf build error with GCC 4.4.

Vinson

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] tools include: Fix strict-aliasing rules breakage "tools/include/linux/compiler.h:66: error: dereferencing pointer ‘res.41’ does break strict-aliasing rules"
  2015-10-13  0:48   ` Vinson Lee
@ 2015-10-13  8:52     ` Jiri Olsa
  2015-10-13 14:44       ` Arnaldo Carvalho de Melo
  2015-10-14 13:14       ` [tip:perf/core] tools include: Fix strict-aliasing rules breakage tip-bot for Jiri Olsa
  0 siblings, 2 replies; 7+ messages in thread
From: Jiri Olsa @ 2015-10-13  8:52 UTC (permalink / raw)
  To: Vinson Lee, Arnaldo Carvalho de Melo
  Cc: linux-next, Peter Zijlstra, Ingo Molnar, Andi Kleen,
	Adrian Hunter, Jiri Olsa, Rabin Vincent, Martin Liška

On Mon, Oct 12, 2015 at 05:48:17PM -0700, Vinson Lee wrote:

SNIP

> >                 __builtin_memcpy((void *)res, (const void *)p, size);
> > @@ -59,11 +64,14 @@ static __always_inline void __read_once_size(const volatile void *p, void *res,
> >
> >  static __always_inline void __write_once_size(volatile void *p, void *res, int size)
> >  {
> > +       u64_alias_t *u64_p = (u64_alias_t*) p;
> > +       u64_alias_t *u64_res = (u64_alias_t*) res;
> > +
> >         switch (size) {
> >         case 1: *(volatile __u8 *)p = *(__u8 *)res; break;
> >         case 2: *(volatile __u16 *)p = *(__u16 *)res; break;
> >         case 4: *(volatile __u32 *)p = *(__u32 *)res; break;
> > -       case 8: *(volatile __u64 *)p = *(__u64 *)res; break;
> > +       case 8: *u64_p = *u64_res; break;
> >         default:
> >                 barrier();
> >                 __builtin_memcpy((void *)p, (const void *)res, size);
> 
> 
> This patch fixes my perf build error with GCC 4.4.
> 
> Vinson

posting complete patch

thanks,
jirka


---
Vinson reported build breakage with gcc 4.4 due to strict-aliasing.

   CC       util/annotate.o
 cc1: warnings being treated as errors
 util/annotate.c: In function ‘disasm__purge’:
 linux-next/tools/include/linux/compiler.h:66: error: dereferencing
 pointer ‘res.41’ does break strict-aliasing rules

The reason is READ_ONCE/WRITE_ONCE code we took from kernel sources.
They intentionaly break aliasing rules. While this is ok for kernel
because it's built with -fno-strict-aliasing, it breaks perf which
is build with -Wstrict-aliasing=3.

Using extra __may_alias__ type to allow aliasing in this case.

Reported-by: Vinson Lee <vlee@twopensource.com>
Link: http://lkml.kernel.org/n/tip-ffqyehdzx3w41j6smao15t0a@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/include/linux/compiler.h | 32 ++++++++++++++++++++++++--------
 1 file changed, 24 insertions(+), 8 deletions(-)

diff --git a/tools/include/linux/compiler.h b/tools/include/linux/compiler.h
index 9098083869c8..fa7208a32d76 100644
--- a/tools/include/linux/compiler.h
+++ b/tools/include/linux/compiler.h
@@ -43,13 +43,29 @@
 
 #include <linux/types.h>
 
+/*
+ * Following functions are taken from kernel sources and
+ * break aliasing rules in their original form.
+ *
+ * While kernel is compiled with -fno-strict-aliasing,
+ * perf uses -Wstrict-aliasing=3 which makes build fail
+ * under gcc 4.4.
+ *
+ * Using extra __may_alias__ type to allow aliasing
+ * in this case.
+ */
+typedef __u8  __attribute__((__may_alias__))  __u8_alias_t;
+typedef __u16 __attribute__((__may_alias__)) __u16_alias_t;
+typedef __u32 __attribute__((__may_alias__)) __u32_alias_t;
+typedef __u64 __attribute__((__may_alias__)) __u64_alias_t;
+
 static __always_inline void __read_once_size(const volatile void *p, void *res, int size)
 {
 	switch (size) {
-	case 1: *(__u8 *)res = *(volatile __u8 *)p; break;
-	case 2: *(__u16 *)res = *(volatile __u16 *)p; break;
-	case 4: *(__u32 *)res = *(volatile __u32 *)p; break;
-	case 8: *(__u64 *)res = *(volatile __u64 *)p; break;
+	case 1: *(__u8_alias_t  *) res = *(volatile __u8_alias_t  *) p; break;
+	case 2: *(__u16_alias_t *) res = *(volatile __u16_alias_t *) p; break;
+	case 4: *(__u32_alias_t *) res = *(volatile __u32_alias_t *) p; break;
+	case 8: *(__u64_alias_t *) res = *(volatile __u64_alias_t *) p; break;
 	default:
 		barrier();
 		__builtin_memcpy((void *)res, (const void *)p, size);
@@ -60,10 +76,10 @@ static __always_inline void __read_once_size(const volatile void *p, void *res,
 static __always_inline void __write_once_size(volatile void *p, void *res, int size)
 {
 	switch (size) {
-	case 1: *(volatile __u8 *)p = *(__u8 *)res; break;
-	case 2: *(volatile __u16 *)p = *(__u16 *)res; break;
-	case 4: *(volatile __u32 *)p = *(__u32 *)res; break;
-	case 8: *(volatile __u64 *)p = *(__u64 *)res; break;
+	case 1: *(volatile  __u8_alias_t *) p = *(__u8_alias_t  *) res; break;
+	case 2: *(volatile __u16_alias_t *) p = *(__u16_alias_t *) res; break;
+	case 4: *(volatile __u32_alias_t *) p = *(__u32_alias_t *) res; break;
+	case 8: *(volatile __u64_alias_t *) p = *(__u64_alias_t *) res; break;
 	default:
 		barrier();
 		__builtin_memcpy((void *)p, (const void *)res, size);
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] tools include: Fix strict-aliasing rules breakage "tools/include/linux/compiler.h:66: error: dereferencing pointer ‘res.41’ does break strict-aliasing rules"
  2015-10-13  8:52     ` [PATCH] tools include: Fix strict-aliasing rules breakage " Jiri Olsa
@ 2015-10-13 14:44       ` Arnaldo Carvalho de Melo
  2015-10-14 13:14       ` [tip:perf/core] tools include: Fix strict-aliasing rules breakage tip-bot for Jiri Olsa
  1 sibling, 0 replies; 7+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-10-13 14:44 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Vinson Lee, linux-next, Peter Zijlstra, Ingo Molnar, Andi Kleen,
	Adrian Hunter, Jiri Olsa, Rabin Vincent, Martin Liška

Em Tue, Oct 13, 2015 at 10:52:14AM +0200, Jiri Olsa escreveu:
> On Mon, Oct 12, 2015 at 05:48:17PM -0700, Vinson Lee wrote:
> 
> SNIP
> 
> > >                 __builtin_memcpy((void *)res, (const void *)p, size);
> > > @@ -59,11 +64,14 @@ static __always_inline void __read_once_size(const volatile void *p, void *res,
> > >
> > >  static __always_inline void __write_once_size(volatile void *p, void *res, int size)
> > >  {
> > > +       u64_alias_t *u64_p = (u64_alias_t*) p;
> > > +       u64_alias_t *u64_res = (u64_alias_t*) res;
> > > +
> > >         switch (size) {
> > >         case 1: *(volatile __u8 *)p = *(__u8 *)res; break;
> > >         case 2: *(volatile __u16 *)p = *(__u16 *)res; break;
> > >         case 4: *(volatile __u32 *)p = *(__u32 *)res; break;
> > > -       case 8: *(volatile __u64 *)p = *(__u64 *)res; break;
> > > +       case 8: *u64_p = *u64_res; break;
> > >         default:
> > >                 barrier();
> > >                 __builtin_memcpy((void *)p, (const void *)res, size);
> > 
> > 
> > This patch fixes my perf build error with GCC 4.4.
> > 
> > Vinson
> 
> posting complete patch

Applied, with a tested-by Vinson,

thanks,

- Arnaldo

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [tip:perf/core] tools include: Fix strict-aliasing rules breakage
  2015-10-13  8:52     ` [PATCH] tools include: Fix strict-aliasing rules breakage " Jiri Olsa
  2015-10-13 14:44       ` Arnaldo Carvalho de Melo
@ 2015-10-14 13:14       ` tip-bot for Jiri Olsa
  1 sibling, 0 replies; 7+ messages in thread
From: tip-bot for Jiri Olsa @ 2015-10-14 13:14 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, hpa, jolsa, rabin, mliska, jolsa,
	a.p.zijlstra, vlee, tglx, adrian.hunter, mingo, ak

Commit-ID:  c95f3432118c6b7a3bde63aa6eb95ccd163119eb
Gitweb:     http://git.kernel.org/tip/c95f3432118c6b7a3bde63aa6eb95ccd163119eb
Author:     Jiri Olsa <jolsa@redhat.com>
AuthorDate: Tue, 13 Oct 2015 10:52:14 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 13 Oct 2015 11:43:16 -0300

tools include: Fix strict-aliasing rules breakage

Vinson reported build breakage with gcc 4.4 due to strict-aliasing.

   CC       util/annotate.o
 cc1: warnings being treated as errors
 util/annotate.c: In function ‘disasm__purge’:
 linux-next/tools/include/linux/compiler.h:66: error: dereferencing
 pointer ‘res.41’ does break strict-aliasing rules

The reason is READ_ONCE/WRITE_ONCE code we took from kernel sources.  They
intentionaly break aliasing rules. While this is ok for kernel because it's
built with -fno-strict-aliasing, it breaks perf which is build with
-Wstrict-aliasing=3.

Using extra __may_alias__ type to allow aliasing in this case.

Reported-and-tested-by: Vinson Lee <vlee@twopensource.com>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Martin Liska <mliska@suse.cz>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Rabin Vincent <rabin@rab.in>
Cc: linux-next@vger.kernel.org
Link: http://lkml.kernel.org/r/20151013085214.GB2705@krava.brq.redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/include/linux/compiler.h | 32 ++++++++++++++++++++++++--------
 1 file changed, 24 insertions(+), 8 deletions(-)

diff --git a/tools/include/linux/compiler.h b/tools/include/linux/compiler.h
index 9098083..fa7208a 100644
--- a/tools/include/linux/compiler.h
+++ b/tools/include/linux/compiler.h
@@ -43,13 +43,29 @@
 
 #include <linux/types.h>
 
+/*
+ * Following functions are taken from kernel sources and
+ * break aliasing rules in their original form.
+ *
+ * While kernel is compiled with -fno-strict-aliasing,
+ * perf uses -Wstrict-aliasing=3 which makes build fail
+ * under gcc 4.4.
+ *
+ * Using extra __may_alias__ type to allow aliasing
+ * in this case.
+ */
+typedef __u8  __attribute__((__may_alias__))  __u8_alias_t;
+typedef __u16 __attribute__((__may_alias__)) __u16_alias_t;
+typedef __u32 __attribute__((__may_alias__)) __u32_alias_t;
+typedef __u64 __attribute__((__may_alias__)) __u64_alias_t;
+
 static __always_inline void __read_once_size(const volatile void *p, void *res, int size)
 {
 	switch (size) {
-	case 1: *(__u8 *)res = *(volatile __u8 *)p; break;
-	case 2: *(__u16 *)res = *(volatile __u16 *)p; break;
-	case 4: *(__u32 *)res = *(volatile __u32 *)p; break;
-	case 8: *(__u64 *)res = *(volatile __u64 *)p; break;
+	case 1: *(__u8_alias_t  *) res = *(volatile __u8_alias_t  *) p; break;
+	case 2: *(__u16_alias_t *) res = *(volatile __u16_alias_t *) p; break;
+	case 4: *(__u32_alias_t *) res = *(volatile __u32_alias_t *) p; break;
+	case 8: *(__u64_alias_t *) res = *(volatile __u64_alias_t *) p; break;
 	default:
 		barrier();
 		__builtin_memcpy((void *)res, (const void *)p, size);
@@ -60,10 +76,10 @@ static __always_inline void __read_once_size(const volatile void *p, void *res,
 static __always_inline void __write_once_size(volatile void *p, void *res, int size)
 {
 	switch (size) {
-	case 1: *(volatile __u8 *)p = *(__u8 *)res; break;
-	case 2: *(volatile __u16 *)p = *(__u16 *)res; break;
-	case 4: *(volatile __u32 *)p = *(__u32 *)res; break;
-	case 8: *(volatile __u64 *)p = *(__u64 *)res; break;
+	case 1: *(volatile  __u8_alias_t *) p = *(__u8_alias_t  *) res; break;
+	case 2: *(volatile __u16_alias_t *) p = *(__u16_alias_t *) res; break;
+	case 4: *(volatile __u32_alias_t *) p = *(__u32_alias_t *) res; break;
+	case 8: *(volatile __u64_alias_t *) p = *(__u64_alias_t *) res; break;
 	default:
 		barrier();
 		__builtin_memcpy((void *)p, (const void *)res, size);

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-10-14 13:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-07 18:28 next-20151007 perf build error "tools/include/linux/compiler.h:66: error: dereferencing pointer ‘res.41’ does break strict-aliasing rules" Vinson Lee
2015-10-07 18:47 ` Arnaldo Carvalho de Melo
2015-10-08  9:12 ` Jiri Olsa
2015-10-13  0:48   ` Vinson Lee
2015-10-13  8:52     ` [PATCH] tools include: Fix strict-aliasing rules breakage " Jiri Olsa
2015-10-13 14:44       ` Arnaldo Carvalho de Melo
2015-10-14 13:14       ` [tip:perf/core] tools include: Fix strict-aliasing rules breakage tip-bot for Jiri Olsa

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.