Re: [U-Boot] [PATCH 2/9] Fix strict-aliasing warning in dlmalloc

2012-09-04 Thread Andreas Bießmann

Dear Simon Glas,

On 13.08.2012 17:25, Andreas Bießmann wrote:

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 s...@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);

--^

Ouch ... isn't there something missing? Who increments the pointer? ;)


your patch breaks avr32 boards at runtime:


Will send a new version which supersedes this one and 
http://patchwork.ozlabs.org/patch/176885/


Best regards

Andreas Bießmann
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/9] Fix strict-aliasing warning in dlmalloc

2012-08-13 Thread Andreas Bießmann
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 s...@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:  - 00013588  data: 0001ab70 - 00050448
VMR table @ 0x107ca4bc
DMA: Using memory from 0x1076b000 to 0x1076f000
Flash: 8 MiB at address 0x
DRAM Configuration:
Bank #0: 1000 8 MiB

 *** Unhandled exception 24 at PC=0x107b442e [542e]
MMU exception at address 0x7af1ade4
   pc: 107b442elr: 0001b1c8sp: 1076aecc   r12: 0001
  r11:    r10: 0079r9: 107c9de8r8: 107c9de0
   r7: 0001r6: 107ca9acr5: 1076af90r4: 007e
   r3: 7af1ade0r2: 107cb8f0r1: r0: 107cb908
Flags: qvnzc
Mode bits: hrjeg
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
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/9] Fix strict-aliasing warning in dlmalloc

2012-01-08 Thread Mike Frysinger
On Friday 06 January 2012 15:39:08 Simon Glass wrote:
 On Thu, Jan 5, 2012 at 10:48 PM, Wolfgang Denk wrote:
  Simon Glass wrote:
  This fixes the following warnings in dlmalloc seen with my gcc 4.6.
  
  Which exact version is this?
  
  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
  
  Can you please tell me at least one board configuration that throws
  this error (preferrably ppc, arm or mips) ?
 
 I can't see one with those architectures. It does happen for others though:

yes, there have been reports and patches posted in the past iirc.  first by 
Kumar i think.
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/9] Fix strict-aliasing warning in dlmalloc

2012-01-07 Thread Simon Glass
Hi Wolfgang,

On Fri, Jan 6, 2012 at 3:37 PM, Wolfgang Denk w...@denx.de wrote:
 Dear Simon,

 In message 
 capnjgz1oxjjsseodsm-fqtn791mw-uezqwjflqbas-4rbfh...@mail.gmail.com you 
 wrote:

  Can you please tell me at least one board configuration that throws
  this error (preferrably ppc, arm or mips) ?

 I can't see one with those architectures. It does happen for others though:
 ...

 Strange.  Both MIPS and PPC build without a single warning for me.

 I cannot test avr32 or m68k here.

  Also, at least one for the mpc5xxx: Fix strict-aliasing warnings in
  usb_ohci.c and ppc4xx: Fix strict-aliasing warnings in usb_ohci.c
  patches?

 None here.

 I am tempted to blame your tool chain for the problems.

Could be - well you can download it for yourself if you want to try it.

http://dev.gentoo.org/~vapier/u-boot/

The warnings seems mostly reasonable (i.e. correct) to me, except for
the new USB alias one AFTER Marek's fix. That one I don't quite
understand.


 Is anybody else seing these warnings? With which tool chain versions?

Will wait to hear from people.

Regards,
Simon


 Best regards,

 Wolfgang Denk

 --
 DENX Software Engineering GmbH,     MD: Wolfgang Denk  Detlev Zundel
 HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
 Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
 If you fail to plan, plan to fail.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/9] Fix strict-aliasing warning in dlmalloc

2012-01-06 Thread Simon Glass
Hi Wolfgang,

On Thu, Jan 5, 2012 at 10:48 PM, Wolfgang Denk w...@denx.de wrote:
 Dear Simon Glass,

 In message 1325822097-15227-3-git-send-email-...@chromium.org you wrote:
 This fixes the following warnings in dlmalloc seen with my gcc 4.6.

 Which exact version is this?

 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

 Can you please tell me at least one board configuration that throws
 this error (preferrably ppc, arm or mips) ?

I can't see one with those architectures. It does happen for others though:

$ (for b in $(cd ~/cosarm/buildall/logs.master.9a42098  grep -l 1493
*ERR |sed 's/.ERR//'); do grep $b boards.cfg; done ) |awk '{print $2,
$1}'
avr32 atngw100
avr32 atstk1002
avr32 atstk1003
avr32 atstk1004
avr32 atstk1006
mips dbau1000
mips dbau1100
mips dbau1500
mips dbau1550
mips dbau1550_el
avr32 favr-32-ezkit
avr32 grasshopper
mips gth2
avr32 hammerhead
mips incaip
mips incaip_100MHz
mips incaip_133MHz
mips incaip_150MHz
m68k M54451EVB
m68k M54451EVB_stmicro
m68k M54451EVB_stmicro
m68k M54455EVB_a66
m68k M54455EVB
m68k M54455EVB_a66
m68k M54455EVB_i66
m68k M54455EVB_intel
m68k M54455EVB_stm33
m68k M54455EVB_i66
m68k M54455EVB_intel
m68k M54455EVB_stm33
m68k M5475AFE
m68k M5475BFE
m68k M5475CFE
m68k M5475DFE
m68k M5475EFE
m68k M5475FFE
m68k M5475GFE
m68k M5485AFE
m68k M5485BFE
m68k M5485CFE
m68k M5485DFE
m68k M5485EFE
m68k M5485FFE
m68k M5485GFE
m68k M5485HFE
avr32 mimc200
mips qemu_mips
mips vct_platinumavc
mips vct_platinumavc_onenand
mips vct_platinumavc_onenand_small
mips vct_platinumavc_small
mips vct_platinumavc_onenand
mips vct_platinumavc_onenand_small
mips vct_platinumavc_onenand_small
mips vct_platinumavc_small
mips vct_platinum
mips vct_platinumavc
mips vct_platinumavc_onenand
mips vct_platinumavc_onenand_small
mips vct_platinumavc_small
mips vct_platinum_onenand
mips vct_platinum_onenand_small
mips vct_platinum_small
mips vct_platinum_onenand
mips vct_platinum_onenand_small
mips vct_platinum_onenand_small
mips vct_platinum_small
mips vct_premium
mips vct_premium_onenand
mips vct_premium_onenand_small
mips vct_premium_small
mips vct_premium_onenand
mips vct_premium_onenand_small
mips vct_premium_onenand_small
mips vct_premium_small

Using built-in specs.
Target: mips-linux
Configured with: /home/tony/buildall/src/gcc/configure
--target=mips-linux --enable-targets=all
--prefix=/opt/cross/gcc-4.4.4-nolibc/mips-linux/ --enable-languages=c
--with-newlib --without-headers --enable-sjlj-exceptions
--with-system-libunwind --disable-nls --disable-threads
--disable-shared --disable-libmudflap --disable-libssp
--disable-libgomp --disable-decimal-float --enable-checking=release
--with-mpfr=/home/tony/buildall/src/sys
--with-gmp=/home/tony/buildall/src/sys
Thread model: single
gcc version 4.4.4 (GCC)

Using built-in specs.
Target: m68k-linux
Configured with: /home/tony/buildall/src/gcc/configure
--target=m68k-linux --enable-targets=all
--prefix=/opt/cross/gcc-4.4.4-nolibc/m68k-linux/ --enable-languages=c
--with-newlib --without-headers --enable-sjlj-exceptions
--with-system-libunwind --disable-nls --disable-threads
--disable-shared --disable-libmudflap --disable-libssp
--disable-libgomp --disable-decimal-float --enable-checking=release
--with-mpfr=/home/tony/buildall/src/sys
--with-gmp=/home/tony/buildall/src/sys
Thread model: single
gcc version 4.4.4 (GCC)

Using built-in specs.
Target: powerpc-linux
Configured with: /home/tony/buildall/src/gcc/configure
--target=powerpc-linux --enable-targets=all
--prefix=/opt/cross/gcc-4.4.4-nolibc/powerpc-linux/
--enable-languages=c --with-newlib --without-headers
--enable-sjlj-exceptions --with-system-libunwind --disable-nls
--disable-threads --disable-shared --disable-libmudflap
--disable-libssp --disable-libgomp --disable-decimal-float
--enable-checking=release --with-mpfr=/home/tony/buildall/src/sys
--with-gmp=/home/tony/buildall/src/sys
Thread model: single
gcc version 4.4.4 (GCC)

From here:

http://dev.gentoo.org/~vapier/u-boot/


 Also, at least one for the mpc5xxx: Fix strict-aliasing warnings in
 usb_ohci.c and ppc4xx: Fix strict-aliasing warnings in usb_ohci.c
 patches?

powerpc BC3450
powerpc cm5200
powerpc EVAL5200
powerpc galaxy5200
powerpc galaxy5200_LOWBOOT
powerpc galaxy5200_LOWBOOT
powerpc inka4x0
powerpc mcc200_COM12
powerpc mcc200_COM12_highboot
powerpc mcc200_COM12_highboot_SDRAM
powerpc mcc200_COM12_SDRAM
powerpc mcc200_COM12_highboot
powerpc mcc200_COM12_highboot_SDRAM
powerpc mcc200_COM12_highboot_SDRAM
powerpc mcc200_COM12_SDRAM
powerpc mcc200
powerpc mcc200_COM12
powerpc mcc200_COM12_highboot
powerpc mcc200_COM12_highboot_SDRAM
powerpc mcc200_COM12_SDRAM
powerpc mcc200_highboot
powerpc mcc200_highboot_SDRAM
powerpc mcc200_SDRAM
powerpc prs200
powerpc prs200_DDR
powerpc 

Re: [U-Boot] [PATCH 2/9] Fix strict-aliasing warning in dlmalloc

2012-01-06 Thread Wolfgang Denk
Dear Simon,

In message capnjgz1oxjjsseodsm-fqtn791mw-uezqwjflqbas-4rbfh...@mail.gmail.com 
you wrote:
 
  Can you please tell me at least one board configuration that throws
  this error (preferrably ppc, arm or mips) ?
 
 I can't see one with those architectures. It does happen for others though:
...

Strange.  Both MIPS and PPC build without a single warning for me.

I cannot test avr32 or m68k here.

  Also, at least one for the mpc5xxx: Fix strict-aliasing warnings in
  usb_ohci.c and ppc4xx: Fix strict-aliasing warnings in usb_ohci.c
  patches?

None here.

I am tempted to blame your tool chain for the problems.

Is anybody else seing these warnings? With which tool chain versions?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
If you fail to plan, plan to fail.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 2/9] Fix strict-aliasing warning in dlmalloc

2012-01-05 Thread Simon Glass
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

Signed-off-by: Simon Glass s...@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);
 }
 #endif
 
-- 
1.7.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/9] Fix strict-aliasing warning in dlmalloc

2012-01-05 Thread Wolfgang Denk
Dear Simon Glass,

In message 1325822097-15227-3-git-send-email-...@chromium.org you wrote:
 This fixes the following warnings in dlmalloc seen with my gcc 4.6.

Which exact version is this?

 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

Can you please tell me at least one board configuration that throws
this error (preferrably ppc, arm or mips) ?

Also, at least one for the mpc5xxx: Fix strict-aliasing warnings in
usb_ohci.c and ppc4xx: Fix strict-aliasing warnings in usb_ohci.c
patches?

I wonder why I don't see any such warnings.  Which exact commit ID are
you building?

Thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
Make it right before you make it faster.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot