* [U-Boot] [PATCH] UBIFS: Fix dereferencing type-punned pointer compiler warning
@ 2010-12-25 9:58 Dirk Behme
2011-01-11 10:10 ` Stefan Roese
0 siblings, 1 reply; 2+ messages in thread
From: Dirk Behme @ 2010-12-25 9:58 UTC (permalink / raw)
To: u-boot
Fix compiler warning
In file included from ubifs.h:2137:0,
from ubifs.c:26:
misc.h: In function 'ubifs_idx_key':
misc.h:263:26: warning: dereferencing type-punned pointer will break strict-aliasing rules
seen with gcc version 4.5.1 (Sourcery G++ Lite 2010.09-50).
No functional change.
CC: Stefan Roese <sr@denx.de>
Signed-off-by: Dirk Behme <dirk.behme@googlemail.com>
---
This was found building 'omap3_pandora' with the above tool chain.
Note: Compiling the ubifs (make fs/ubifs) in a recent mainline kernel
(2.6.37-rc7) with the same tool chain doesn't give this warning.
There seems to be no difference in the recent ubifs kernel sources
regarding this piece of code (structs ubifs_idx_node, ubifs_branch
and the function ubifs_idx_key in misc.h), though.
So I'm not sure why this warning is in U-Boot but not in the kernel.
Different compiler options?
fs/ubifs/misc.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Index: u-boot.git/fs/ubifs/misc.h
===================================================================
--- u-boot.git.orig/fs/ubifs/misc.h
+++ u-boot.git/fs/ubifs/misc.h
@@ -260,7 +260,8 @@ struct ubifs_branch *ubifs_idx_branch(co
static inline void *ubifs_idx_key(const struct ubifs_info *c,
const struct ubifs_idx_node *idx)
{
- return (void *)((struct ubifs_branch *)idx->branches)->key;
+ const __u8 *branch = idx->branches;
+ return (void *)((struct ubifs_branch *)branch)->key;
}
/**
^ permalink raw reply [flat|nested] 2+ messages in thread
* [U-Boot] [PATCH] UBIFS: Fix dereferencing type-punned pointer compiler warning
2010-12-25 9:58 [U-Boot] [PATCH] UBIFS: Fix dereferencing type-punned pointer compiler warning Dirk Behme
@ 2011-01-11 10:10 ` Stefan Roese
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Roese @ 2011-01-11 10:10 UTC (permalink / raw)
To: u-boot
On Saturday 25 December 2010 10:58:46 Dirk Behme wrote:
> Fix compiler warning
>
> In file included from ubifs.h:2137:0,
> from ubifs.c:26:
> misc.h: In function 'ubifs_idx_key':
> misc.h:263:26: warning: dereferencing type-punned pointer will break
> strict-aliasing rules
>
> seen with gcc version 4.5.1 (Sourcery G++ Lite 2010.09-50).
>
> No functional change.
Applied to u-boot-ubi. Thanks.
Cheers,
Stefan
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-01-11 10:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-25 9:58 [U-Boot] [PATCH] UBIFS: Fix dereferencing type-punned pointer compiler warning Dirk Behme
2011-01-11 10:10 ` Stefan Roese
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox