diff options
author | Simon Glass <sjg@chromium.org> | 2012-09-04 11:31:07 +0000 |
---|---|---|
committer | Andreas Bießmann <andreas.devel@googlemail.com> | 2012-09-13 13:32:41 +0200 |
commit | 93691842e8dc86e6b2cb148c7c60a168654bbc34 (patch) | |
tree | d912399c27d75842db47b97135aaadb78fb924c0 | |
parent | a6f0c4faa4c65a7b7048b12c9d180d7e1aad1721 (diff) | |
download | u-boot-imx-93691842e8dc86e6b2cb148c7c60a168654bbc34.zip u-boot-imx-93691842e8dc86e6b2cb148c7c60a168654bbc34.tar.gz u-boot-imx-93691842e8dc86e6b2cb148c7c60a168654bbc34.tar.bz2 |
Fix strict-aliasing warning in dlmalloc
This fixes the following warnings in dlmalloc seen with my gcc 4.6.
dlmalloc.c: In function 'malloc_bin_reloc':
dlmalloc.c:1493: warning: dereferencing pointer 'p' does break strict-aliasing rules
dlmalloc.c:1493: warning: dereferencing pointer 'p' does break strict-aliasing rules
dlmalloc.c:1490: note: initialized from here
dlmalloc.c:1493: note: initialized from here
This version is tested on avr32 arch boards.
Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
-rw-r--r-- | common/dlmalloc.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/common/dlmalloc.c b/common/dlmalloc.c index c645d73..1d7e527 100644 --- a/common/dlmalloc.c +++ b/common/dlmalloc.c @@ -1487,11 +1487,11 @@ static mbinptr av_[NAV * 2 + 2] = { #ifdef CONFIG_NEEDS_MANUAL_RELOC void malloc_bin_reloc (void) { - unsigned long *p = (unsigned long *)(&av_[2]); - int i; - for (i=2; i<(sizeof(av_)/sizeof(mbinptr)); ++i) { - *p++ += gd->reloc_off; - } + mbinptr *p = &av_[2]; + size_t i; + + for (i = 2; i < ARRAY_SIZE(av_); ++i, ++p) + *p = (mbinptr)((ulong)*p + gd->reloc_off); } #endif |