Actions
Bug #4911
closedC-backend fails to inline constants
Start date:
05/08/2014
Due date:
% Done:
0%
Estimated time:
Detected in build:
svn
Platform:
Published in build:
Description
For such the code:
static int const * const vvaraddr_vgetcpu_mode = (void *)((-10*1024*1024 - 4096) + (16));
...
static inline unsigned int __getcpu(void)
{
...
if ((*vvaraddr_vgetcpu_mode) == 1) {
...
}
...
}
with enabled GCC optimizations (-Os) C-backend generates:
static int const *const vvaraddr_vgetcpu_mode = 18446744073699061776;
...
static inline unsigned int __getcpu(void)
{
...
if (( int ) * 18446744073699061776 == 1)
{
...
}
...
}
which is obviously improper. Proper code is the following:
static int const *const vvaraddr_vgetcpu_mode = 18446744073699061776;
...
static inline unsigned int __getcpu(void)
{
...
if (( int ) * (int *)18446744073699061776 == 1)
{
...
}
...
}
Linux kernel 3.13-rc1 is subjected to the given issue while 3.5 isn't.
Actions