On Jul 5, 2008, at 5:32 PM, Wolfgang Denk wrote:

> In message <[EMAIL PROTECTED]>  
> you wrote:
>> When we building with gcc-4.3.x on a ppc host we get the following  
>> warnings:
>>
>> dlmalloc.c: In function 'malloc_extend_top':
>> dlmalloc.c:1971: warning: dereferencing type-punned pointer will  
>> break strict-aliasing rules
>> dlmalloc.c:1999: warning: dereferencing type-punned pointer will  
>> break strict-aliasing rules
> ...
>> This is due to pointer aliasing that the dlmalloc code does and  
>> depends on.
>
> Can you please explain why the dlmalloc code depends on this?

That's what Scott said when I asked about this on the list.

> In my experience so far it has always been possible to avoid such
> warnings by trivial changes to the code (the tricky part was usually
> to understand what the exact problem was and what changes were
> necessary).
>
>> Instead of trying trying to work around the warnings, we use the  
>> per file
>> CFLAGs to disable the warnings via -fno-strict-aliasing.
>
> I tend to reject this patch. I would much rather have the problem
> fixed in the sources. Hushing up compiler warnings has never been a
> good idea.

I'm all for trying to fix the code to git rid of the warnings, however  
nothing I tried was able to accomplish that.

The root of the warnings is the bin_at() macro:

#define bin_at(i)      ((mbinptr)((char*)&(av_[2*(i) + 2]) - 2*SIZE_SZ))
#define next_bin(b)    ((mbinptr)((char*)(b) + 2 * sizeof(mbinptr)))
#define prev_bin(b)    ((mbinptr)((char*)(b) - 2 * sizeof(mbinptr)))

- 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

Reply via email to