[U-Boot] [PATCH] board/flagadm/flash.c: fix compile warning
Scott Wood
scottwood at freescale.com
Fri Sep 11 18:33:21 CEST 2009
On Fri, Sep 11, 2009 at 11:18:19AM +0200, Wolfgang Denk wrote:
> Fix warning: flash.c:531: warning: dereferencing type-punned pointer
> will break strict-aliasing rules
>
> Signed-off-by: Wolfgang Denk <wd at denx.de>
> Cc: K?ri Dav??sson <kd at flaga.is>
> ---
> board/flagadm/flash.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/board/flagadm/flash.c b/board/flagadm/flash.c
> index bbefbac..ff37d9e 100644
> --- a/board/flagadm/flash.c
> +++ b/board/flagadm/flash.c
> @@ -528,7 +528,8 @@ int write_word (flash_info_t *info, ulong dest, ulong da)
> ulong start;
> char csr;
> int flag;
> - 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.
-Scott
More information about the U-Boot
mailing list