kbuild: fix a compile warning
PATCH 1/1 kbuild: fix a compile warning
I got this warning:
HOSTCC scripts/basic/fixdepscripts/basic/fixdep.c: In function 'traps':scripts/basic/fixdep.c:377: warning: dereferencing type-punned pointer will break strict-aliasing rules scripts/basic/fixdep.c:379: warning: dereferencing type-punned pointer will break strict-aliasing rules
Patch below fixes it.
---
scripts/basic/fixdep.c +3 -2
@@ -373,10 +373,11 @@ void print_deps(void)void traps (void ) { static char test[] __attribute__((aligned(sizeof(int)))) = "CONF"; +int *p = (int *)test; -if (*(int *)test !=INT_CONF ) { +if (*p !=INT_CONF ) {fprintf (stderr,"fixdep: sizeof(int) != 4 or wrong endianess? %#x\n" , - *(int *)test); + *p);exit (2 ); } }
Quoted 2 lines · On Fri, 15 May 2009 03:51:18 -0400 Amerigo Wang <[email protected]> wrote:
I got this warning:
With which gcc version?
Quoted 5 lines
HOSTCC
scripts/basic/fixdepscripts/basic/fixdep.c: In function 'traps':scripts/basic/fixdep.c:377: warning: dereferencing type-punned pointer will break strict-aliasing rulesscripts/basic/fixdep.c:379: warning: dereferencing type-punned pointer will break strict-aliasing rules
(wtf?)
Quoted 17 lines
scripts/basic/fixdep.c +3
-2@@ -373,10 +373,11 @@ void print_deps(void)void traps (void ) { static char test[] __attribute__((aligned(sizeof(int)))) = "CONF"; +int *p = (int *)test; -if (*(int *)test !=INT_CONF ) { +if (*p !=INT_CONF ) {fprintf (stderr,"fixdep: sizeof(int) != 4 or wrong endianess? %#x\n" , - *(int *)test); + *p);exit (2 ); } }
Quoted 8 lines · Andrew Morton
Quoted 2 lines · On Fri, 15 May 2009 03:51:18 -0400 Amerigo Wang <[email protected]> wrote:
I got this warning:
With which gcc version?
gcc version 4.4.0 (GCC)
Quoted 10 lines
Quoted 7 lines
HOSTCC
scripts/basic/fixdepscripts/basic/fixdep.c: In function 'traps':scripts/basic/fixdep.c:377: warning: dereferencing type-punned pointer will break strict-aliasing rulesscripts/basic/fixdep.c:379: warning: dereferencing type-punned pointer will break strict-aliasing rules(wtf?)
Try the man page of gcc for -fstrict-aliasing. :)
Quoted 6 lines · Amerigo Wang
Quoted 5 lines · Andrew Morton
Quoted 1 line · On Fri, 15 May 2009 03:51:18 -0400 Amerigo Wang <[email protected]> wrote:
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
I got this warning:
With which gcc version?
gcc version 4.4.0 (GCC)
I'm also getting this warning on 4.4.1. Can we merge this patch?
Signature · 1 line
Felipe Contreras
Quoted 5 lines · Felipe Contreras
Quoted 4 lines · Amerigo Wang
Quoted 3 lines · Andrew Morton
On Fri, 15 May 2009 03:51:18 -0400 Amerigo Wang <[email protected]> wrote:
Quoted 8 lines
Quoted 5 lines
Quoted 4 lines
Quoted 2 lines
I got this warning:
With which gcc version?
gcc version 4.4.0 (GCC)
I'm also getting this warning on 4.4.1. Can we merge this patch?
I believe we already merged this patch in
commit d067aa7.
Can you try the latest linus git tree?
Thanks.
Quoted 16 lines · Amerigo Wang
Quoted 15 lines · Felipe Contreras
Quoted 12 lines · Amerigo Wang
Quoted 9 lines · Andrew Morton
Quoted 2 lines · On Fri, 15 May 2009 03:51:18 -0400 Amerigo Wang <[email protected]> wrote:
I got this warning:
With which gcc version?
gcc version 4.4.0 (GCC)
Quoted 7 lines
Quoted 2 lines
I'm also getting this warning on 4.4.1. Can we merge this patch?
I believe we already merged this patch in
commit d067aa7.Can you try the latest linus git tree?
Sorry, yeah, I realized I was using an old tag after I sent the mail. Thanks.
Signature · 1 line
Felipe Contreras
Quoted 7 lines · Amerigo Wang
I got this warning:
HOSTCC scripts/basic/fixdep
scripts/basic/fixdep.c: In function 'traps':scripts/basic/fixdep.c:377: warning: dereferencing type-punned pointer will break strict-aliasing rulesscripts/basic/fixdep.c:379: warning: dereferencing type-punned pointer will break strict-aliasing rules
these warnings can be supressed by adding a compile option -fno-strict-aliasing
Quoted 31 lines
Patch below fixes it.
Signed-off-by WANG Cong <[email protected]>Cc Sam Ravnborg <[email protected]>---
scripts/basic/fixdep.c +3
-3@@ -373,10 +373,11 @@ void print_deps(void) void traps(void) { static char test[] __attribute__((aligned(sizeof(int)))) = "CONF"; + int *p = (int *)test; - if (*(int *)test != INT_CONF) { + if (*p != INT_CONF) { fprintf(stderr, "fixdep: sizeof(int) != 4 or wrong endianess? %#x\n", - *(int *)test); + *p); exit(2); } } --To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Quoted 9 lines · Amerigo Wang
I got this warning:
HOSTCC
scripts/basic/fixdepscripts/basic/fixdep.c: In function 'traps':scripts/basic/fixdep.c:377: warning: dereferencing type-punned pointer will break strict-aliasing rulesscripts/basic/fixdep.c:379: warning: dereferencing type-punned pointer will break strict-aliasing rulesPatch below fixes it.
We do not use -fno-strict-aliasing at userspace, so fix seems ok. Applied.
Sam