dlmalloc.c: Fix gcc alias warning
authorJoakim Tjernlund <Joakim.Tjernlund@transmode.se>
Thu, 14 Oct 2010 06:51:34 +0000 (08:51 +0200)
committerWolfgang Denk <wd@denx.de>
Mon, 18 Oct 2010 20:44:31 +0000 (22:44 +0200)
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 <Joakim.Tjernlund@transmode.se>
Acked-by: Mike Frysinger <vapier@gentoo.org>
common/dlmalloc.c

index ae5702dd52ae178d0e0e16d46a173dbdd927d75c..fce7a762b1ed177906f03968c2ca0f4a8dcacbbf 100644 (file)
@@ -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;