From: "Andreas Bießmann" <andreas.devel@googlemail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/9] Fix strict-aliasing warning in dlmalloc
Date: Mon, 13 Aug 2012 17:25:33 +0200 [thread overview]
Message-ID: <50291C6D.7030101@gmail.com> (raw)
In-Reply-To: <1325822097-15227-3-git-send-email-sjg@chromium.org>
Dear Simon Glass,
On 06.01.2012 04:54, Simon Glass wrote:
> 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 is really annoying, but ...
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> common/dlmalloc.c | 8 ++++----
> 1 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/common/dlmalloc.c b/common/dlmalloc.c
> index c645d73..0a719b4 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]);
> + mbinptr *p = &av_[2];
> int i;
> - for (i=2; i<(sizeof(av_)/sizeof(mbinptr)); ++i) {
> - *p++ += gd->reloc_off;
> - }
> +
> + for (i = 2; i < ARRAY_SIZE(av_); ++i)
> + *p = (mbinptr)((ulong)*p + gd->reloc_off);
your patch breaks avr32 boards at runtime:
---8<---
U-Boot 2012.07-00134-g6073aab (Aug 13 2012 - 17:16:34)
U-Boot code: 00000000 -> 00013588 data: 0001ab70 -> 00050448
VMR table @ 0x107ca4bc
DMA: Using memory from 0x1076b000 to 0x1076f000
Flash: 8 MiB at address 0x00000000
DRAM Configuration:
Bank #0: 10000000 8 MiB
*** Unhandled exception 24 at PC=0x107b442e [0000542e]
MMU exception at address 0x7af1ade4
pc: 107b442e lr: 0001b1c8 sp: 1076aecc r12: 00000001
r11: 00000000 r10: 00000079 r9: 107c9de8 r8: 107c9de0
r7: 00010000 r6: 107ca9ac r5: 1076af90 r4: 0000007e
r3: 7af1ade0 r2: 107cb8f0 r1: 00000000 r0: 107cb908
Flags: qvnzc
Mode bits: hrje....g
CPU Mode: Supervisor
--->8---
A working solution is http://patchwork.ozlabs.org/patch/176885/
Would be great to remove this aliasing warning in 2012.10
Best regards
Andreas Bie?mann
next prev parent reply other threads:[~2012-08-13 15:25 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-06 3:54 [U-Boot] [PATCH 0/9] Fix a few warnings that bug me Simon Glass
2012-01-06 3:54 ` [U-Boot] [PATCH 1/9] usb: Fix strict-aliasing warning in host/ohci-hcd.c Simon Glass
2012-01-08 9:32 ` Mike Frysinger
2012-01-08 18:02 ` Simon Glass
2012-01-06 3:54 ` [U-Boot] [PATCH 2/9] Fix strict-aliasing warning in dlmalloc Simon Glass
2012-01-06 6:48 ` Wolfgang Denk
2012-01-06 20:39 ` Simon Glass
2012-01-06 23:37 ` Wolfgang Denk
2012-01-08 0:57 ` Simon Glass
2012-01-08 9:27 ` Mike Frysinger
2012-08-13 15:25 ` Andreas Bießmann [this message]
2012-09-04 21:25 ` Andreas Bießmann
2012-01-06 3:54 ` [U-Boot] [PATCH 3/9] mpc5xxx: Fix strict-aliasing warnings in usb_ohci.c Simon Glass
2012-01-06 3:54 ` [U-Boot] [PATCH 4/9] ppc4xx: " Simon Glass
2012-10-16 6:28 ` Marek Vasut
2012-10-16 13:35 ` Simon Glass
2012-01-06 3:54 ` [U-Boot] [PATCH 5/9] sandbox: sort header files in os.c Simon Glass
2012-01-08 8:49 ` Mike Frysinger
2012-01-09 22:17 ` Simon Glass
2012-01-06 3:54 ` [U-Boot] [PATCH 6/9] sandbox: Add required header to os.c Simon Glass
2012-01-08 8:49 ` Mike Frysinger
2012-01-09 22:18 ` Simon Glass
2012-01-06 3:54 ` [U-Boot] [PATCH 7/9] Remove CONFIG_SYS_EXTBDINFO from snapper9260.h Simon Glass
2012-02-22 11:07 ` Stefano Babic
2012-03-27 16:58 ` Anatolij Gustschin
2012-01-06 3:54 ` [U-Boot] [PATCH 8/9] m68k: Change memsz to a signed char to avoid warning Simon Glass
2012-01-08 9:29 ` Mike Frysinger
2012-02-22 12:01 ` Stefano Babic
2012-01-06 3:54 ` [U-Boot] [PATCH 9/9] ppc: Change memsz variable to signed char Simon Glass
2012-01-08 9:29 ` Mike Frysinger
2012-02-22 12:00 ` Stefano Babic
2012-01-06 6:20 ` [U-Boot] [PATCH 0/9] Fix a few warnings that bug me Wolfgang Denk
2012-01-06 6:28 ` Simon Glass
2012-02-20 18:49 ` Simon Glass
2012-02-21 10:20 ` Stefano Babic
2012-02-21 13:49 ` Stefano Babic
2012-02-21 17:06 ` Mike Frysinger
2012-02-21 17:15 ` Stefano Babic
2012-02-21 18:40 ` Simon Glass
2012-02-22 5:35 ` Mike Frysinger
2012-02-22 11:06 ` Stefano Babic
2012-03-03 14:31 ` Wolfgang Denk
2012-03-05 18:22 ` Marek Vasut
2012-03-05 18:33 ` Simon Glass
2012-03-05 18:42 ` Andy Pont
2012-03-05 19:17 ` Wolfgang Denk
2012-03-05 18:46 ` Marek Vasut
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=50291C6D.7030101@gmail.com \
--to=andreas.devel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox