lkml.org 
[lkml]   [2018]   [Sep]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] perf: enum overflow in uapi/linux/perf_event.h
On Fri, Sep 07, 2018 at 03:58:17PM +0200, Peter Zijlstra wrote:
> 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.

What does the below proglet print on your PPC32 box? I suspect the
output will be:

400000000000

and all is well.

---
#include <stdio.h>

enum ponies {
big = 1ULL<<46,
};

int main(int argc, char **argv)
{
unsigned long long val = big;
printf("%Lx\n", val);
return 0;
}

\
 
 \ /
  Last update: 2018-09-07 16:14    [W:0.111 / U:1.160 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site