lkml.org 
[lkml]   [2009]   [May]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [Patch] kbuild: fix a compile warning
On Fri, 15 May 2009 03:51:18 -0400 Amerigo Wang <amwang@redhat.com> wrote:

>
> I got this warning:

With which gcc version?

> 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
>

(wtf?)

>
> --- a/scripts/basic/fixdep.c
> +++ b/scripts/basic/fixdep.c
> @@ -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);
> }
> }


\
 
 \ /
  Last update: 2009-05-28 09:45    [W:0.650 / U:0.852 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site