From: Wolfgang Denk Date: Thu, 31 Jul 2008 11:22:04 +0200 Subject: [U-Boot-Users] [UPDATED][PATCH v2] Fix compile warnings in dlmalloc In-Reply-To: Your message of "Wed, 30 Jul 2008 08:01:15 CDT." Message-ID: <20080731092204.0144C248B9@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de In message you wrote: > The origional code was using on odd reference to get to the first > real element in av_[]. The first two elements of the array are > not used for actual bins, but for house keeping. If we are more > explicit about how use the first few elements we can get rid of the > 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 > dlmalloc.c:2029: warning: dereferencing type-punned pointer will break strict-aliasing rules ... > > The logic of how this code came to be is: > bin_at(0) = (char*)&(av_[2]) - 2*SIZE_SZ > > SIZE_SZ is the size of pointer, and av_ is arry of pointers so: > bin_at(0) = &(av_[0]) > > Going from there to bin_at(0)->fd or bin_at(0)->size should be straight forward. > > Signed-off-by: Kumar Gala > --- > > Updated against lastest head, added a bit more commit info about the logic > of the change. > > common/dlmalloc.c | 21 +++++++++++---------- > 1 files changed, 11 insertions(+), 10 deletions(-) Applied, 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: wd at denx.de Unser Kopf ist rund, damit das Denken die Richtung wechseln kann. -- Francis Picabia