[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

Kumar,
Try adding -fno-strict-aliasing
Marc Howard
-----Original Message----- From: u-boot-users-bounces@lists.sourceforge.net [mailto:u-boot-users-bounces@lists.sourceforge.net] On Behalf Of Kumar Gala Sent: Thursday, July 10, 2008 9:59 AM To: u-boot-users@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@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/u-boot-users

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

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

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

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

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

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
participants (5)
-
Howard, Marc
-
Jerry Van Baren
-
Kumar Gala
-
Scott Wood
-
Wolfgang Denk