public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] HELP, trying to remove complier warnings
@ 2008-07-10 16:58 Kumar Gala
  2008-07-10 17:59 ` Howard, Marc
  0 siblings, 1 reply; 8+ messages in thread
From: Kumar Gala @ 2008-07-10 16:58 UTC (permalink / raw)
  To: u-boot

I'm running with gcc-4.3 from fedora 9.  I get the following warnings:

dlmalloc.c: In function ?malloc_extend_top?:
dlmalloc.c:1971: error: dereferencing type-punned pointer will break  
strict-aliasing rules
dlmalloc.c:1999: error: dereferencing type-punned pointer will break  
strict-aliasing rules
dlmalloc.c:2029: error: dereferencing type-punned pointer will break  
strict-aliasing rules
dlmalloc.c:2031: error: dereferencing type-punned pointer will break  
strict-aliasing rules
dlmalloc.c:2042: error: dereferencing type-punned pointer will break  
strict-aliasing rules
dlmalloc.c: In function ?malloc?:
dlmalloc.c:2245: error: dereferencing type-punned pointer will break  
strict-aliasing rules
dlmalloc.c:2245: error: dereferencing type-punned pointer will break  
strict-aliasing rules
dlmalloc.c:2253: error: dereferencing type-punned pointer will break  
strict-aliasing rules
dlmalloc.c:2258: error: dereferencing type-punned pointer will break  
strict-aliasing rules
dlmalloc.c:2263: error: dereferencing type-punned pointer will break  
strict-aliasing rules
dlmalloc.c:2318: error: dereferencing type-punned pointer will break  
strict-aliasing rules
dlmalloc.c:2327: error: dereferencing type-punned pointer will break  
strict-aliasing rules
dlmalloc.c:2329: error: dereferencing type-punned pointer will break  
strict-aliasing rules
dlmalloc.c:2344: error: dereferencing type-punned pointer will break  
strict-aliasing rules
dlmalloc.c:2356: error: dereferencing type-punned pointer will break  
strict-aliasing rules
dlmalloc.c:2360: error: dereferencing type-punned pointer will break  
strict-aliasing rules
dlmalloc.c:2362: error: dereferencing type-punned pointer will break  
strict-aliasing rules
dlmalloc.c:2363: error: dereferencing type-punned pointer will break  
strict-aliasing rules
dlmalloc.c: In function ?free?:
dlmalloc.c:2431: error: dereferencing type-punned pointer will break  
strict-aliasing rules
dlmalloc.c:2444: error: dereferencing type-punned pointer will break  
strict-aliasing rules
dlmalloc.c:2483: error: dereferencing type-punned pointer will break  
strict-aliasing rules
dlmalloc.c:2483: error: dereferencing type-punned pointer will break  
strict-aliasing rules
dlmalloc.c: In function ?realloc?:
dlmalloc.c:2594: error: dereferencing type-punned pointer will break  
strict-aliasing rules
dlmalloc.c:2599: error: dereferencing type-punned pointer will break  
strict-aliasing rules
dlmalloc.c:2604: error: dereferencing type-punned pointer will break  
strict-aliasing rules
dlmalloc.c:2605: error: dereferencing type-punned pointer will break  
strict-aliasing rules
dlmalloc.c:2637: error: dereferencing type-punned pointer will break  
strict-aliasing rules
dlmalloc.c:2646: error: dereferencing type-punned pointer will break  
strict-aliasing rules
dlmalloc.c:2647: error: dereferencing type-punned pointer will break  
strict-aliasing rules
dlmalloc.c: In function ?calloc?:
dlmalloc.c:2896: error: dereferencing type-punned pointer will break  
strict-aliasing rules
dlmalloc.c:2897: error: dereferencing type-punned pointer will break  
strict-aliasing rules
dlmalloc.c: In function ?malloc_trim?:
dlmalloc.c:2987: error: dereferencing type-punned pointer will break  
strict-aliasing rules
dlmalloc.c:2997: error: dereferencing type-punned pointer will break  
strict-aliasing rules
dlmalloc.c:3008: error: dereferencing type-punned pointer will break  
strict-aliasing rules
dlmalloc.c:3012: error: dereferencing type-punned pointer will break  
strict-aliasing rules
dlmalloc.c:3021: error: dereferencing type-punned pointer will break  
strict-aliasing rules

They all result from the bin_at macro in the file.  I can't seem to do  
anything to the code to get rid of them.

I see these both on x86 or ppc host builds:

x86:

gcc -g  -Os -m32    -D__KERNEL__ -DTEXT_BASE=0x387c0000 -I/local/home/ 
galak/u-boot/include -fno-builtin -ffreestanding -nostdinc -isystem / 
usr/lib/gcc/x86_64-redhat-linux/4.3.0/include -pipe  -DCONFIG_I386 - 
D__I386__ -march=i386 -Werror -Wall -Wstrict-prototypes -fno-stack- 
protector -c -o dlmalloc.o dlmalloc.c

ppc:

gcc -g  -Os   -fPIC -ffixed-r14 -meabi -D__KERNEL__ - 
DTEXT_BASE=0xeff80000 -I/local/home/galak/git/u-boot-85xx/include -fno- 
builtin -ffreestanding -nostdinc -isystem /usr/lib/gcc/ppc64-redhat- 
linux/4.3.0/include -pipe  -DCONFIG_PPC -D__powerpc__ -DCONFIG_MPC85xx  
-DCONFIG_E500 -ffixed-r2 -Wa,-me500 -msoft-float -mno-string -mno-spe - 
DCONFIG_E500=1 -DCONFIG_MPC85xx=1 -DCONFIG_PPC_P4080=1 -Wall -Wstrict- 
prototypes -fno-stack-protector  -c -o dlmalloc.o dlmalloc.c

- k	

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot-Users] HELP, trying to remove complier warnings
  2008-07-10 16:58 [U-Boot-Users] HELP, trying to remove complier warnings Kumar Gala
@ 2008-07-10 17:59 ` Howard, Marc
  2008-07-10 18:42   ` Wolfgang Denk
  0 siblings, 1 reply; 8+ messages in thread
From: Howard, Marc @ 2008-07-10 17:59 UTC (permalink / raw)
  To: u-boot

Kumar,

Try adding -fno-strict-aliasing

Marc Howard 

> -----Original Message-----
> From: u-boot-users-bounces at lists.sourceforge.net 
> [mailto:u-boot-users-bounces at lists.sourceforge.net] On Behalf 
> Of Kumar Gala
> Sent: Thursday, July 10, 2008 9:59 AM
> To: u-boot-users at lists.sourceforge.net Users
> Subject: [U-Boot-Users] HELP, trying to remove complier warnings
> 
> I'm running with gcc-4.3 from fedora 9.  I get the following warnings:
> 
> dlmalloc.c: In function 'malloc_extend_top':
> dlmalloc.c:1971: error: dereferencing type-punned pointer will break  
> strict-aliasing rules
> dlmalloc.c:1999: error: dereferencing type-punned pointer will break  
> strict-aliasing rules
> dlmalloc.c:2029: error: dereferencing type-punned pointer will break  
> strict-aliasing rules
> dlmalloc.c:2031: error: dereferencing type-punned pointer will break  
> strict-aliasing rules
> dlmalloc.c:2042: error: dereferencing type-punned pointer will break  
> strict-aliasing rules
> dlmalloc.c: In function 'malloc':
> dlmalloc.c:2245: error: dereferencing type-punned pointer will break  
> strict-aliasing rules
> dlmalloc.c:2245: error: dereferencing type-punned pointer will break  
> strict-aliasing rules
> dlmalloc.c:2253: error: dereferencing type-punned pointer will break  
> strict-aliasing rules
> dlmalloc.c:2258: error: dereferencing type-punned pointer will break  
> strict-aliasing rules
> dlmalloc.c:2263: error: dereferencing type-punned pointer will break  
> strict-aliasing rules
> dlmalloc.c:2318: error: dereferencing type-punned pointer will break  
> strict-aliasing rules
> dlmalloc.c:2327: error: dereferencing type-punned pointer will break  
> strict-aliasing rules
> dlmalloc.c:2329: error: dereferencing type-punned pointer will break  
> strict-aliasing rules
> dlmalloc.c:2344: error: dereferencing type-punned pointer will break  
> strict-aliasing rules
> dlmalloc.c:2356: error: dereferencing type-punned pointer will break  
> strict-aliasing rules
> dlmalloc.c:2360: error: dereferencing type-punned pointer will break  
> strict-aliasing rules
> dlmalloc.c:2362: error: dereferencing type-punned pointer will break  
> strict-aliasing rules
> dlmalloc.c:2363: error: dereferencing type-punned pointer will break  
> strict-aliasing rules
> dlmalloc.c: In function 'free':
> dlmalloc.c:2431: error: dereferencing type-punned pointer will break  
> strict-aliasing rules
> dlmalloc.c:2444: error: dereferencing type-punned pointer will break  
> strict-aliasing rules
> dlmalloc.c:2483: error: dereferencing type-punned pointer will break  
> strict-aliasing rules
> dlmalloc.c:2483: error: dereferencing type-punned pointer will break  
> strict-aliasing rules
> dlmalloc.c: In function 'realloc':
> dlmalloc.c:2594: error: dereferencing type-punned pointer will break  
> strict-aliasing rules
> dlmalloc.c:2599: error: dereferencing type-punned pointer will break  
> strict-aliasing rules
> dlmalloc.c:2604: error: dereferencing type-punned pointer will break  
> strict-aliasing rules
> dlmalloc.c:2605: error: dereferencing type-punned pointer will break  
> strict-aliasing rules
> dlmalloc.c:2637: error: dereferencing type-punned pointer will break  
> strict-aliasing rules
> dlmalloc.c:2646: error: dereferencing type-punned pointer will break  
> strict-aliasing rules
> dlmalloc.c:2647: error: dereferencing type-punned pointer will break  
> strict-aliasing rules
> dlmalloc.c: In function 'calloc':
> dlmalloc.c:2896: error: dereferencing type-punned pointer will break  
> strict-aliasing rules
> dlmalloc.c:2897: error: dereferencing type-punned pointer will break  
> strict-aliasing rules
> dlmalloc.c: In function 'malloc_trim':
> dlmalloc.c:2987: error: dereferencing type-punned pointer will break  
> strict-aliasing rules
> dlmalloc.c:2997: error: dereferencing type-punned pointer will break  
> strict-aliasing rules
> dlmalloc.c:3008: error: dereferencing type-punned pointer will break  
> strict-aliasing rules
> dlmalloc.c:3012: error: dereferencing type-punned pointer will break  
> strict-aliasing rules
> dlmalloc.c:3021: error: dereferencing type-punned pointer will break  
> strict-aliasing rules
> 
> They all result from the bin_at macro in the file.  I can't 
> seem to do  
> anything to the code to get rid of them.
> 
> I see these both on x86 or ppc host builds:
> 
> x86:
> 
> gcc -g  -Os -m32    -D__KERNEL__ -DTEXT_BASE=0x387c0000 
> -I/local/home/ 
> galak/u-boot/include -fno-builtin -ffreestanding -nostdinc -isystem / 
> usr/lib/gcc/x86_64-redhat-linux/4.3.0/include -pipe  -DCONFIG_I386 - 
> D__I386__ -march=i386 -Werror -Wall -Wstrict-prototypes -fno-stack- 
> protector -c -o dlmalloc.o dlmalloc.c
> 
> ppc:
> 
> gcc -g  -Os   -fPIC -ffixed-r14 -meabi -D__KERNEL__ - 
> DTEXT_BASE=0xeff80000 
> -I/local/home/galak/git/u-boot-85xx/include -fno- 
> builtin -ffreestanding -nostdinc -isystem /usr/lib/gcc/ppc64-redhat- 
> linux/4.3.0/include -pipe  -DCONFIG_PPC -D__powerpc__ 
> -DCONFIG_MPC85xx  
> -DCONFIG_E500 -ffixed-r2 -Wa,-me500 -msoft-float -mno-string 
> -mno-spe - 
> DCONFIG_E500=1 -DCONFIG_MPC85xx=1 -DCONFIG_PPC_P4080=1 -Wall 
> -Wstrict- 
> prototypes -fno-stack-protector  -c -o dlmalloc.o dlmalloc.c
> 
> - k	
> 
> --------------------------------------------------------------
> -----------
> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
> Studies have shown that voting for your favorite open source project,
> along with a healthy diet, reduces your potential for chronic lameness
> and boredom. Vote Now at http://www.sourceforge.net/community/cca08
> _______________________________________________
> U-Boot-Users mailing list
> U-Boot-Users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/u-boot-users
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot-Users] HELP, trying to remove complier warnings
  2008-07-10 17:59 ` Howard, Marc
@ 2008-07-10 18:42   ` Wolfgang Denk
  2008-07-10 18:43     ` Scott Wood
  0 siblings, 1 reply; 8+ messages in thread
From: Wolfgang Denk @ 2008-07-10 18:42 UTC (permalink / raw)
  To: u-boot

In message <921B6E79C3E18642BFFC1C8633C430DB01023B9A@CA1EXCLV07.adcorp.kla-tencor.com> you wrote:
> 
> Try adding -fno-strict-aliasing

No, we don't want to hush up compiler warnings, we want to fix the
problems instead.

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: wd at denx.de
The first thing we do is kill all the lawyers.
(Shakespeare. II Henry VI, Act IV, scene ii)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot-Users] HELP, trying to remove complier warnings
  2008-07-10 18:42   ` Wolfgang Denk
@ 2008-07-10 18:43     ` Scott Wood
  2008-07-10 18:58       ` Wolfgang Denk
  2008-07-18  5:35       ` Kumar Gala
  0 siblings, 2 replies; 8+ messages in thread
From: Scott Wood @ 2008-07-10 18:43 UTC (permalink / raw)
  To: u-boot

Wolfgang Denk wrote:
> In message <921B6E79C3E18642BFFC1C8633C430DB01023B9A@CA1EXCLV07.adcorp.kla-tencor.com> you wrote:
>> Try adding -fno-strict-aliasing
> 
> No, we don't want to hush up compiler warnings, we want to fix the
> problems instead.

It's not silencing a warning (if it were, it'd be a -W flag); it's 
disabling an incompatible optimization.

-Scott

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot-Users] HELP, trying to remove complier warnings
  2008-07-10 18:43     ` Scott Wood
@ 2008-07-10 18:58       ` Wolfgang Denk
  2008-07-10 19:06         ` Scott Wood
  2008-07-18  5:35       ` Kumar Gala
  1 sibling, 1 reply; 8+ messages in thread
From: Wolfgang Denk @ 2008-07-10 18:58 UTC (permalink / raw)
  To: u-boot

In message <48765849.5050306@freescale.com> you wrote:
> Wolfgang Denk wrote:
> > In message <921B6E79C3E18642BFFC1C8633C430DB01023B9A@CA1EXCLV07.adcorp.kla-tencor.com> you wrote:
> >> Try adding -fno-strict-aliasing
> > 
> > No, we don't want to hush up compiler warnings, we want to fix the
> > problems instead.
> 
> It's not silencing a warning (if it were, it'd be a -W flag); it's 
> disabling an incompatible optimization.

OK.

Then let me rephrase: We do not want to disable optimizations, ...

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: wd at denx.de
The more sins you confess, the more books you will sell.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot-Users] HELP, trying to remove complier warnings
  2008-07-10 18:58       ` Wolfgang Denk
@ 2008-07-10 19:06         ` Scott Wood
  0 siblings, 0 replies; 8+ messages in thread
From: Scott Wood @ 2008-07-10 19:06 UTC (permalink / raw)
  To: u-boot

Wolfgang Denk wrote:
> In message <48765849.5050306@freescale.com> you wrote:
>> Wolfgang Denk wrote:
>>> In message <921B6E79C3E18642BFFC1C8633C430DB01023B9A@CA1EXCLV07.adcorp.kla-tencor.com> you wrote:
>>>> Try adding -fno-strict-aliasing
>>> No, we don't want to hush up compiler warnings, we want to fix the
>>> problems instead.
>> It's not silencing a warning (if it were, it'd be a -W flag); it's 
>> disabling an incompatible optimization.
> 
> OK.
> 
> Then let me rephrase: We do not want to disable optimizations, ...

If you want to figure out what that code is doing and rewrite it to be 
compliant with strict aliasing, go ahead (I tried, and it made my brain 
hurt).  In the meantime, we shouldn't be enabling the optimization on 
code that was written for an older version of the C language where such 
an optimization was prohibited, and where the compiler is letting us 
know that it thinks the code depends on the older semantics.

-Scott

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot-Users] HELP, trying to remove complier warnings
  2008-07-10 18:43     ` Scott Wood
  2008-07-10 18:58       ` Wolfgang Denk
@ 2008-07-18  5:35       ` Kumar Gala
  2008-07-19 13:47         ` Jerry Van Baren
  1 sibling, 1 reply; 8+ messages in thread
From: Kumar Gala @ 2008-07-18  5:35 UTC (permalink / raw)
  To: u-boot


On Jul 10, 2008, at 1:43 PM, Scott Wood wrote:

> Wolfgang Denk wrote:
>> In message <921B6E79C3E18642BFFC1C8633C430DB01023B9A@CA1EXCLV07.adcorp.kla-tencor.com 
>> > you wrote:
>>> Try adding -fno-strict-aliasing
>>
>> No, we don't want to hush up compiler warnings, we want to fix the
>> problems instead.
>
> It's not silencing a warning (if it were, it'd be a -W flag); it's
> disabling an incompatible optimization.

Did we come to any resolution on this?

I'm with Scott in that trying to re-write the code isn't worth the  
pain and its reasonable to disable the optimization until someone is  
willing to update to a newer dlmalloc which might not have the issue.

- k

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot-Users] HELP, trying to remove complier warnings
  2008-07-18  5:35       ` Kumar Gala
@ 2008-07-19 13:47         ` Jerry Van Baren
  0 siblings, 0 replies; 8+ messages in thread
From: Jerry Van Baren @ 2008-07-19 13:47 UTC (permalink / raw)
  To: u-boot

Kumar Gala wrote:
> On Jul 10, 2008, at 1:43 PM, Scott Wood wrote:
> 
>> Wolfgang Denk wrote:
>>> In message <921B6E79C3E18642BFFC1C8633C430DB01023B9A@CA1EXCLV07.adcorp.kla-tencor.com 
>>>> you wrote:
>>>> Try adding -fno-strict-aliasing
>>> No, we don't want to hush up compiler warnings, we want to fix the
>>> problems instead.
>> It's not silencing a warning (if it were, it'd be a -W flag); it's
>> disabling an incompatible optimization.
> 
> Did we come to any resolution on this?
> 
> I'm with Scott in that trying to re-write the code isn't worth the  
> pain and its reasonable to disable the optimization until someone is  
> willing to update to a newer dlmalloc which might not have the issue.
> 
> - k

FWIIW, +1 for me too.

gvb

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-07-19 13:47 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-10 16:58 [U-Boot-Users] HELP, trying to remove complier warnings Kumar Gala
2008-07-10 17:59 ` Howard, Marc
2008-07-10 18:42   ` Wolfgang Denk
2008-07-10 18:43     ` Scott Wood
2008-07-10 18:58       ` Wolfgang Denk
2008-07-10 19:06         ` Scott Wood
2008-07-18  5:35       ` Kumar Gala
2008-07-19 13:47         ` Jerry Van Baren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox