* [U-Boot] [PATCH] Fix strict-aliasing warning in dlmalloc
@ 2012-09-04 21:31 andreas.devel at googlemail.com
2012-09-04 21:40 ` Andreas Bießmann
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: andreas.devel at googlemail.com @ 2012-09-04 21:31 UTC (permalink / raw)
To: u-boot
From: Simon Glass <sjg@chromium.org>
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>
---
since v1:
* use size_t for array counter instead of int
* increment the pinter for next iteration
common/dlmalloc.c | 10 +++++-----
1 file 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
--
1.7.10.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] Fix strict-aliasing warning in dlmalloc
2012-09-04 21:31 [U-Boot] [PATCH] Fix strict-aliasing warning in dlmalloc andreas.devel at googlemail.com
@ 2012-09-04 21:40 ` Andreas Bießmann
2012-09-05 9:41 ` Andreas Bießmann
2012-09-13 12:19 ` Andreas Bießmann
2 siblings, 0 replies; 4+ messages in thread
From: Andreas Bießmann @ 2012-09-04 21:40 UTC (permalink / raw)
To: u-boot
Dear Andreas Bie?mann,
On 04.09.2012 23:31, andreas.devel at googlemail.com wrote:
> From: Simon Glass <sjg@chromium.org>
>
> 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>
> ---
> since v1:
> * use size_t for array counter instead of int
> * increment the pinter for next iteration
damn, this is in fact a [PATCH v2]. It is a successor of
http://patchwork.ozlabs.org/patch/134597/
Best regards
Andreas Bie?mann
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] Fix strict-aliasing warning in dlmalloc
2012-09-04 21:31 [U-Boot] [PATCH] Fix strict-aliasing warning in dlmalloc andreas.devel at googlemail.com
2012-09-04 21:40 ` Andreas Bießmann
@ 2012-09-05 9:41 ` Andreas Bießmann
2012-09-13 12:19 ` Andreas Bießmann
2 siblings, 0 replies; 4+ messages in thread
From: Andreas Bießmann @ 2012-09-05 9:41 UTC (permalink / raw)
To: u-boot
Dear all,
On 04.09.2012 23:31, andreas.devel at googlemail.com wrote:
> From: Simon Glass <sjg@chromium.org>
>
> 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>
> ---
if no one complains I will apply this through u-boot-avr32 next weekend.
Best regards
Andreas Bie?mann
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] Fix strict-aliasing warning in dlmalloc
2012-09-04 21:31 [U-Boot] [PATCH] Fix strict-aliasing warning in dlmalloc andreas.devel at googlemail.com
2012-09-04 21:40 ` Andreas Bießmann
2012-09-05 9:41 ` Andreas Bießmann
@ 2012-09-13 12:19 ` Andreas Bießmann
2 siblings, 0 replies; 4+ messages in thread
From: Andreas Bießmann @ 2012-09-13 12:19 UTC (permalink / raw)
To: u-boot
Dear Andreas Bie?mann,
On 04.09.2012 23:31, andreas.devel at googlemail.com wrote:
> From: Simon Glass <sjg@chromium.org>
>
> 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>
> ---
> since v1:
> * use size_t for array counter instead of int
> * increment the pinter for next iteration
applied to u-boot-avr32/master, thanks!
Best regards
Andreas Bie?mann
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-09-13 12:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-04 21:31 [U-Boot] [PATCH] Fix strict-aliasing warning in dlmalloc andreas.devel at googlemail.com
2012-09-04 21:40 ` Andreas Bießmann
2012-09-05 9:41 ` Andreas Bießmann
2012-09-13 12:19 ` Andreas Bießmann
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.