Commit d067aa741589a9783cc43315119e0f431b4e382c

Authored by Amerigo Wang
Committed by Sam Ravnborg
1 parent f2ac5e7892

kbuild: fix a compile warning

gcc-4.4.1:

 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 rules
scripts/basic/fixdep.c:379: warning: dereferencing type-punned pointer will break strict-aliasing rules

(Apparently -fno-strict-aliasing will fix this too)

Signed-off-by: WANG Cong <amwang@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>

Showing 1 changed file with 3 additions and 2 deletions Side-by-side Diff

scripts/basic/fixdep.c
... ... @@ -373,10 +373,11 @@
373 373 void traps(void)
374 374 {
375 375 static char test[] __attribute__((aligned(sizeof(int)))) = "CONF";
  376 + int *p = (int *)test;
376 377  
377   - if (*(int *)test != INT_CONF) {
  378 + if (*p != INT_CONF) {
378 379 fprintf(stderr, "fixdep: sizeof(int) != 4 or wrong endianess? %#x\n",
379   - *(int *)test);
  380 + *p);
380 381 exit(2);
381 382 }
382 383 }