linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Patch] kbuild: fix a compile warning
@ 2009-05-15  7:51 Amerigo Wang
  2009-05-28  7:41 ` Andrew Morton
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Amerigo Wang @ 2009-05-15  7:51 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm, Amerigo Wang, Sam Ravnborg


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

Patch below fixes it.

Signed-off-by: WANG Cong <amwang@redhat.com>
Cc: Sam Ravnborg <sam@ravnborg.org> 

---
diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c
index 8912c0f..72c1520 100644
--- 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);
 	}
 }

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [Patch] kbuild: fix a compile warning
  2009-05-15  7:51 [Patch] kbuild: fix a compile warning Amerigo Wang
@ 2009-05-28  7:41 ` Andrew Morton
  2009-05-31  2:25   ` Amerigo Wang
  2009-05-28 13:18 ` Luming Yu
  2009-06-05 22:08 ` Sam Ravnborg
  2 siblings, 1 reply; 8+ messages in thread
From: Andrew Morton @ 2009-05-28  7:41 UTC (permalink / raw)
  To: Amerigo Wang; +Cc: linux-kernel, Sam Ravnborg

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);
>  	}
>  }

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Patch] kbuild: fix a compile warning
  2009-05-15  7:51 [Patch] kbuild: fix a compile warning Amerigo Wang
  2009-05-28  7:41 ` Andrew Morton
@ 2009-05-28 13:18 ` Luming Yu
  2009-06-05 22:08 ` Sam Ravnborg
  2 siblings, 0 replies; 8+ messages in thread
From: Luming Yu @ 2009-05-28 13:18 UTC (permalink / raw)
  To: Amerigo Wang; +Cc: linux-kernel, akpm, Sam Ravnborg

On Fri, May 15, 2009 at 3:51 PM, Amerigo Wang <amwang@redhat.com> wrote:
>
> 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 rules
> scripts/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


>
> Patch below fixes it.
>
> Signed-off-by: WANG Cong <amwang@redhat.com>
> Cc: Sam Ravnborg <sam@ravnborg.org>
>
> ---
> diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c
> index 8912c0f..72c1520 100644
> --- 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);
>        }
>  }
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Patch] kbuild: fix a compile warning
  2009-05-28  7:41 ` Andrew Morton
@ 2009-05-31  2:25   ` Amerigo Wang
  2009-09-13 14:05     ` Felipe Contreras
  0 siblings, 1 reply; 8+ messages in thread
From: Amerigo Wang @ 2009-05-31  2:25 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Sam Ravnborg

Andrew Morton wrote:
> On Fri, 15 May 2009 03:51:18 -0400 Amerigo Wang <amwang@redhat.com> wrote:
>
>   
>> I got this warning:
>>     
>
> With which gcc version?
>   

gcc version 4.4.0 (GCC)

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

Try the man page of gcc for -fstrict-aliasing. :)


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Patch] kbuild: fix a compile warning
  2009-05-15  7:51 [Patch] kbuild: fix a compile warning Amerigo Wang
  2009-05-28  7:41 ` Andrew Morton
  2009-05-28 13:18 ` Luming Yu
@ 2009-06-05 22:08 ` Sam Ravnborg
  2 siblings, 0 replies; 8+ messages in thread
From: Sam Ravnborg @ 2009-06-05 22:08 UTC (permalink / raw)
  To: Amerigo Wang; +Cc: linux-kernel, akpm

On Fri, May 15, 2009 at 03:51:18AM -0400, Amerigo Wang wrote:
> 
> 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 rules
> scripts/basic/fixdep.c:379: warning: dereferencing type-punned pointer will break strict-aliasing rules
> 
> Patch below fixes it.

We do not use -fno-strict-aliasing at userspace, so fix seems ok.
Applied.

	Sam

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Patch] kbuild: fix a compile warning
  2009-05-31  2:25   ` Amerigo Wang
@ 2009-09-13 14:05     ` Felipe Contreras
  2009-09-15  8:04       ` Amerigo Wang
  0 siblings, 1 reply; 8+ messages in thread
From: Felipe Contreras @ 2009-09-13 14:05 UTC (permalink / raw)
  To: Amerigo Wang; +Cc: Andrew Morton, linux-kernel, Sam Ravnborg

On Sun, May 31, 2009 at 5:25 AM, Amerigo Wang <amwang@redhat.com> wrote:
> Andrew Morton wrote:
>>
>> On Fri, 15 May 2009 03:51:18 -0400 Amerigo Wang <amwang@redhat.com> wrote:
>>
>>
>>>
>>> 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?

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Patch] kbuild: fix a compile warning
  2009-09-13 14:05     ` Felipe Contreras
@ 2009-09-15  8:04       ` Amerigo Wang
  2009-09-15  8:33         ` Felipe Contreras
  0 siblings, 1 reply; 8+ messages in thread
From: Amerigo Wang @ 2009-09-15  8:04 UTC (permalink / raw)
  To: Felipe Contreras; +Cc: Andrew Morton, linux-kernel, Sam Ravnborg

Felipe Contreras wrote:
> On Sun, May 31, 2009 at 5:25 AM, Amerigo Wang <amwang@redhat.com> wrote:
>> Andrew Morton wrote:
>>> On Fri, 15 May 2009 03:51:18 -0400 Amerigo Wang <amwang@redhat.com> wrote:
>>>
>>>
>>>> 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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Patch] kbuild: fix a compile warning
  2009-09-15  8:04       ` Amerigo Wang
@ 2009-09-15  8:33         ` Felipe Contreras
  0 siblings, 0 replies; 8+ messages in thread
From: Felipe Contreras @ 2009-09-15  8:33 UTC (permalink / raw)
  To: Amerigo Wang; +Cc: Andrew Morton, linux-kernel, Sam Ravnborg

On Tue, Sep 15, 2009 at 11:04 AM, Amerigo Wang <amwang@redhat.com> wrote:
> Felipe Contreras wrote:
>>
>> On Sun, May 31, 2009 at 5:25 AM, Amerigo Wang <amwang@redhat.com> wrote:
>>>
>>> Andrew Morton wrote:
>>>>
>>>> On Fri, 15 May 2009 03:51:18 -0400 Amerigo Wang <amwang@redhat.com>
>>>> wrote:
>>>>
>>>>
>>>>> 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?

Sorry, yeah, I realized I was using an old tag after I sent the mail. Thanks.

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-09-15  8:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-15  7:51 [Patch] kbuild: fix a compile warning Amerigo Wang
2009-05-28  7:41 ` Andrew Morton
2009-05-31  2:25   ` Amerigo Wang
2009-09-13 14:05     ` Felipe Contreras
2009-09-15  8:04       ` Amerigo Wang
2009-09-15  8:33         ` Felipe Contreras
2009-05-28 13:18 ` Luming Yu
2009-06-05 22:08 ` Sam Ravnborg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).