From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: Christophe LEROY <christophe.leroy@c-s.fr>
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
linux-sparse@vger.kernel.org
Subject: Re: [PATCH] perf: enum overflow in uapi/linux/perf_event.h
Date: Sat, 8 Sep 2018 01:55:54 +0200 [thread overview]
Message-ID: <20180907235552.6a6oytkzzpn4pcgl@ltop.local> (raw)
In-Reply-To: <20180907184358.pg2ho4m4tc3dpwlw@ltop.local>
On Fri, Sep 07, 2018 at 08:43:59PM +0200, Luc Van Oostenryck wrote:
> On Fri, Sep 07, 2018 at 04:15:33PM +0200, Christophe LEROY wrote:
> > Le 07/09/2018 à 15:58, Peter Zijlstra a écrit :
> > > On Fri, Sep 07, 2018 at 01:50:18PM +0000, Christophe Leroy wrote:
> > > >
> > > >
> > > > On 09/07/2018 01:42 PM, Peter Zijlstra wrote:
> > > > > On Fri, Sep 07, 2018 at 01:27:19PM +0000, Christophe Leroy wrote:
> > > > > > On PPC32, enums are 32 bits, so __PERF_SAMPLE_CALLCHAIN_EARLY is
> > > > > > out of scope. The following sparse warning is encountered:
> > > > > >
> > > > > > CHECK arch/powerpc/kernel/process.c
> > > > > > ./include/uapi/linux/perf_event.h:147:56: warning: cast truncates bits from constant value (8000000000000000 becomes 0)
> > > > >
> > > > > Urgh... what compiler is that? I've not seen anything like that from the
> > > > > build bots.
> > > > >
> > > >
> > > > [root@pc16082vm linux-powerpc]# sparse --version
> > > > 0.5.2
> > > >
> > > > [root@pc16082vm linux-powerpc]# ppc-linux-gcc --version
> > > > ppc-linux-gcc (GCC) 5.4.0
> > >
> > > Ah, that's a sparse warning. But does your GCC agree? The thing is,
> > > sparse uses the C enum spec, but I suspect GCC uses the C++ enum spec
> > > and it all works fine.
>
> Sparse is a bit weird about the exact underlying type used for enums.
>
> > Ah yes, it seems that GCC is happy. So sparse should be fixed instead ?
>
> I'll investigate (I suppose the same is given on x86-32).
It's definitively a bug in sparse. A relatively nasty one and which
open a can of worms. Fortunately, I had already looked at these
problems in May, I just didn't had the time to push the patches.
-- Luc
prev parent reply other threads:[~2018-09-07 23:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <a70172863fa7d3c138f788b18d36524bd45b0a73.1536326078.git.christophe.leroy@c-s.fr>
[not found] ` <20180907134246.GC24106@hirez.programming.kicks-ass.net>
[not found] ` <ae32181d-37b2-1a13-3c72-66775e05ff88@c-s.fr>
[not found] ` <20180907135817.GF24106@hirez.programming.kicks-ass.net>
2018-09-07 14:15 ` [PATCH] perf: enum overflow in uapi/linux/perf_event.h Christophe LEROY
2018-09-07 14:23 ` Peter Zijlstra
2018-09-07 18:43 ` Luc Van Oostenryck
2018-09-07 23:55 ` Luc Van Oostenryck [this message]
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=20180907235552.6a6oytkzzpn4pcgl@ltop.local \
--to=luc.vanoostenryck@gmail.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=christophe.leroy@c-s.fr \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sparse@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.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;
as well as URLs for NNTP newsgroup(s).