From: Scott Wood <scottwood@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] board/flagadm/flash.c: fix compile warning
Date: Fri, 11 Sep 2009 13:28:02 -0500 [thread overview]
Message-ID: <4AAA96B2.7020607@freescale.com> (raw)
In-Reply-To: <20090911181058.1BC89832E864@gemini.denx.de>
Wolfgang Denk wrote:
> Dear Scott Wood,
>
> In message <20090911163321.GB13783@b07421-ec1.am.freescale.net> you wrote:
>>> - ushort * d = (ushort*)&da;
>>> + ulong *dla = &da;
>>> + ushort *d = (ushort*)dla;
>> I don't see how this is any more legal under strict aliasing rules -- you
>> just made it a little more complicated and fooled the compiler into not
>> warning.
>
> Hm... I apologize if I don;t understand this any better, but for me
> silencing the compiler was all that I intended at this moment ;-)
I find that ironic given the previous claim that -fno-strict-aliasing was just
silencing warnings. :-)
Especially since that actually turned off the problematic language feature
(which is more intended for number crunching code than device drivers).
Much like your argument in favor of leaving d-cache disabled, this is a
bootloader -- why complicate it to deal with a fancy compiler optimization that
isn't going to make any performance difference that matters, could break things
even in places where GCC doesn't warn, and is easily disabled?
> Do you have any better approach?
union {
u32 data32;
u16 data16[2];
} data;
data.data32 = da;
if ((addr[0] & data.data16[0]) != data.data16[0] ||
(addr[1] & data.data16[1]) != data.data16[1])
return 2;
etc.
-Scott
next prev parent reply other threads:[~2009-09-11 18:28 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-11 9:18 [U-Boot] [PATCH] kwbimage.c: Fix compile warning when building on 64 bit systems Wolfgang Denk
2009-09-11 9:18 ` [U-Boot] [PATCH] net/bootp.c: fix compile warning Wolfgang Denk
2009-09-14 22:15 ` Wolfgang Denk
2009-09-11 9:18 ` [U-Boot] [PATCH] board/flagadm/flash.c: " Wolfgang Denk
2009-09-11 16:33 ` Scott Wood
2009-09-11 18:10 ` Wolfgang Denk
2009-09-11 18:28 ` Scott Wood [this message]
2009-09-14 22:09 ` [U-Boot] [PATCH v2] " Wolfgang Denk
2009-09-18 21:24 ` Wolfgang Denk
2009-09-11 9:18 ` [U-Boot] [PATCH] drivers/net/natsemi.c: " Wolfgang Denk
2009-09-14 22:10 ` Wolfgang Denk
2009-09-11 9:18 ` [U-Boot] [PATCH] sk98lin: fix compile warnings Wolfgang Denk
2009-09-14 22:11 ` Wolfgang Denk
2009-09-11 9:18 ` [U-Boot] [PATCH] board/esd/common/flash.c: Fix compile warning Wolfgang Denk
2009-09-11 11:24 ` Matthias Fuchs
2009-09-11 13:05 ` Stefan Roese
2009-09-14 22:12 ` Wolfgang Denk
2009-09-11 9:18 ` [U-Boot] [PATCH] board/esd/cpci750/ide.c: fix " Wolfgang Denk
2009-09-11 13:10 ` Stefan Roese
2009-09-14 22:13 ` Wolfgang Denk
2009-09-14 21:33 ` [U-Boot] [PATCH] kwbimage.c: Fix compile warning when building on 64 bit systems Wolfgang Denk
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=4AAA96B2.7020607@freescale.com \
--to=scottwood@freescale.com \
--cc=u-boot@lists.denx.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.