From: Dirk Behme <dirk.behme@googlemail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] UBIFS: Fix dereferencing type-punned pointer compiler warning
Date: Sat, 25 Dec 2010 10:58:46 +0100 [thread overview]
Message-ID: <1293271126-6322-1-git-send-email-dirk.behme@gmail.com> (raw)
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;
}
/**
next reply other threads:[~2010-12-25 9:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-25 9:58 Dirk Behme [this message]
2011-01-11 10:10 ` [U-Boot] [PATCH] UBIFS: Fix dereferencing type-punned pointer compiler warning Stefan Roese
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=1293271126-6322-1-git-send-email-dirk.behme@gmail.com \
--to=dirk.behme@googlemail.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.