[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140226171805.GC22802@laptop.programming.kicks-ass.net>
Date: Wed, 26 Feb 2014 18:18:05 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Jiri Olsa <jolsa@...hat.com>
Cc: linux-kernel@...r.kernel.org,
Corey Ashford <cjashfor@...ux.vnet.ibm.com>,
Frederic Weisbecker <fweisbec@...il.com>,
Ingo Molnar <mingo@...e.hu>,
Namhyung Kim <namhyung@...nel.org>,
Paul Mackerras <paulus@...ba.org>,
Arnaldo Carvalho de Melo <acme@...stprotocols.net>,
David Ahern <dsahern@...il.com>
Subject: Re: [RFC] perf tools: Fix strict alias issue for find_first_bit
On Wed, Feb 26, 2014 at 06:14:26PM +0100, Jiri Olsa wrote:
> hi,
> got issue below when compiling perf tool on i686 with gcc 4.4,
> but not sure the patch is correct workaround here.
>
> thanks for comments,
> jirka
>
>
> ---
> 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’:
> /root/linux/tools/perf/util/include/linux/bitops.h:109: error: dereferencing pointer ‘p’ does break strict-aliasing rules
> /root/linux/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
> /root/linux/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
>
The kernel builds with -fno-strict-aliasing because the C aliasing rules
are a bunch of monkey poo. Perf tool should probably do the same.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists