--- main/astmm.c.orig 2013-05-10 11:29:18.589107067 +0200 +++ main/astmm.c 2013-05-10 11:45:10.391803937 +0200 @@ -102,7 +102,7 @@ * \note Must have the same alignment that malloc returns. * i.e., It is suitably aligned for any kind of varible. */ - unsigned char data[0] __attribute__((aligned)); + unsigned char data[0] __attribute__((aligned(8))); }; /*! Hash table of lists of active allocated memory regions. */ @@ -202,7 +202,7 @@ * reg->data for reg->data alignment. */ fence = (unsigned int *) (reg->data - sizeof(*fence)); - *fence = FENCE_MAGIC; + put_unaligned_uint32(fence, FENCE_MAGIC); /* Init higher fence. */ fence = (unsigned int *) (reg->data + reg->len); @@ -236,7 +236,7 @@ */ end = reg->data + reg->len; for (pos = ®->fence; (void *) pos <= end; ++pos) { - *pos = FREED_MAGIC; + put_unaligned_uint32(pos, FREED_MAGIC); } } @@ -259,7 +259,7 @@ */ end = reg->data + reg->len; for (pos = ®->fence; (void *) pos <= end; ++pos) { - if (*pos != FREED_MAGIC) { + if (get_unaligned_uint32(pos) != FREED_MAGIC) { astmm_log("WARNING: Memory corrupted after free of %p allocated at %s %s() line %d\n", reg->data, reg->file, reg->func, reg->lineno); my_do_crash(); @@ -377,7 +377,7 @@ * reg->data for reg->data alignment. */ fence = (unsigned int *) (reg->data - sizeof(*fence)); - if (*fence != FENCE_MAGIC) { + if (get_unaligned_uint32(fence) != FENCE_MAGIC) { astmm_log("WARNING: Low fence violation of %p allocated at %s %s() line %d\n", reg->data, reg->file, reg->func, reg->lineno); my_do_crash();