[U-Boot] [PATCHv2] dlmalloc.c: Fix gcc alias warning
Joakim Tjernlund
Joakim.Tjernlund at transmode.se
Thu Oct 14 08:51:34 CEST 2010
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 at transmode.se>
---
- forgot signoff
- removed stray attribute change
common/dlmalloc.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/common/dlmalloc.c b/common/dlmalloc.c
index 2276532..77420db 100644
--- a/common/dlmalloc.c
+++ b/common/dlmalloc.c
@@ -1155,7 +1155,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;
--
1.7.2.2
More information about the U-Boot
mailing list