From: Joakim Tjernlund Date: Thu, 14 Oct 2010 06:51:34 +0000 (+0200) Subject: dlmalloc.c: Fix gcc alias warning X-Git-Tag: v2010.12-rc1~85 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=1ba91ba23396005ef7b42381cc21f0baf78d0d60;p=u-boot dlmalloc.c: Fix gcc alias warning Fix these warnings: dlmalloc.c: In function 'free': dlmalloc.c:2507: warning: dereferencing pointer '({anonymous})' does break strict-aliasing rules dlmalloc.c:2507: warning: dereferencing pointer '({anonymous})' does break strict-aliasing rules dlmalloc.c:2507: warning: dereferencing pointer '({anonymous})' does break strict-aliasing rules Some page(http://blog.worldofcoding.com/2010/02/solving-gcc-44-strict-aliasing-problems.html) suggests adding __attribute__((__may_alias__)). Doing so makes the warnings go away. Signed-off-by: Joakim Tjernlund Acked-by: Mike Frysinger --- diff --git a/common/dlmalloc.c b/common/dlmalloc.c index ae5702dd52..fce7a762b1 100644 --- a/common/dlmalloc.c +++ b/common/dlmalloc.c @@ -1152,7 +1152,7 @@ struct malloc_chunk INTERNAL_SIZE_T size; /* Size in bytes, including overhead. */ struct malloc_chunk* fd; /* double links -- used only if free. */ struct malloc_chunk* bk; -}; +} __attribute__((__may_alias__)) ; typedef struct malloc_chunk* mchunkptr;