mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Luming Yu <luming.yu@gmail.com>
To: Amerigo Wang <amwang@redhat.com>
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
	Sam Ravnborg <sam@ravnborg.org>
Subject: Re: [Patch] kbuild: fix a compile warning
Date: Thu, 28 May 2009 21:18:16 +0800	[thread overview]
Message-ID: <3877989d0905280618idba1b35x72ecc222c5cf16a2@mail.gmail.com> (raw)
In-Reply-To: <20090515075229.11346.6710.sendpatchset@localhost.localdomain>

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

  parent reply	other threads:[~2009-05-28 13:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-15  7:51 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 [this message]
2009-06-05 22:08 ` Sam Ravnborg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3877989d0905280618idba1b35x72ecc222c5cf16a2@mail.gmail.com \
    --to=luming.yu@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=amwang@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sam@ravnborg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®