All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Arnaldo Carvalho de Melo <acme@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>,
	linux-kernel@vger.kernel.org, Jiri Olsa <jolsa@redhat.com>,
	Corey Ashford <cjashfor@linux.vnet.ibm.com>,
	David Ahern <dsahern@gmail.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Ingo Molnar <mingo@elte.hu>, Namhyung Kim <namhyung@kernel.org>,
	Paul Mackerras <paulus@samba.org>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: Re: [PATCH 2/2] perf tools: Fix strict alias issue for find_first_bit
Date: Fri, 28 Feb 2014 22:29:23 +0100	[thread overview]
Message-ID: <20140228212923.GI14089@laptop.programming.kicks-ass.net> (raw)
In-Reply-To: <1393622751-21513-3-git-send-email-acme@infradead.org>

On Fri, Feb 28, 2014 at 06:25:51PM -0300, Arnaldo Carvalho de Melo wrote:
> From: Jiri Olsa <jolsa@redhat.com>
> 
> When compiling perf tool code with gcc 4.4.7 I'm getting
> following error:
> 
>     CC       util/session.o
>   cc1: warnings being treated as errors
>   util/session.c: In function ‘perf_session_deliver_event’:
>   tools/perf/util/include/linux/bitops.h:109: error: dereferencing pointer ‘p’ does break strict-aliasing rules
>   tools/perf/util/include/linux/bitops.h:101: error: dereferencing pointer ‘p’ does break strict-aliasing rules
>   util/session.c:697: note: initialized from here
>   tools/perf/util/include/linux/bitops.h:101: note: initialized from here
>   make[1]: *** [util/session.o] Error 1
>   make: *** [util/session.o] Error 2
> 
> The aliased types here are u64 and unsigned long pointers, which is safe
> for the find_first_bit processing.
> 
> This error shows up for me only for gcc 4.4 on 32bit x86, even for
> -Wstrict-aliasing=3, while newer gcc are quiet and scream here for
> -Wstrict-aliasing={2,1}. Looks like newer gcc changed the rules for
> strict alias warnings.
> 
> The gcc documentation offers workaround for valid aliasing by using
> __may_alias__ attribute:
> 
>   http://gcc.gnu.org/onlinedocs/gcc-4.4.0/gcc/Type-Attributes.html
> 
> Using this workaround for the find_first_bit function.

Hurm; didn't I suggest using -fno-strict-aliasing just like the kernel
does? Because the C aliasing rules are bonghits heavy?

  reply	other threads:[~2014-02-28 21:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-28 21:25 [GIT PULL 0/2] perf/urgent fixes Arnaldo Carvalho de Melo
2014-02-28 21:25 ` [PATCH 1/2] perf tools: fix BFD detection on opensuse Arnaldo Carvalho de Melo
2014-02-28 21:25 ` [PATCH 2/2] perf tools: Fix strict alias issue for find_first_bit Arnaldo Carvalho de Melo
2014-02-28 21:29   ` Peter Zijlstra [this message]
2014-03-01  0:03     ` David Ahern
2014-03-01  9:12       ` Ingo Molnar
2014-03-06 20:46     ` Arnaldo Carvalho de Melo
2014-03-01  9:14 ` [GIT PULL 0/2] perf/urgent fixes Ingo Molnar

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=20140228212923.GI14089@laptop.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=acme@infradead.org \
    --cc=acme@redhat.com \
    --cc=cjashfor@linux.vnet.ibm.com \
    --cc=dsahern@gmail.com \
    --cc=fweisbec@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=paulus@samba.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 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.