This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/58065] ARM MALLOC_ABI_ALIGNMENT is wrong
- From: "david.abdurachmanov at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 03 Aug 2013 22:46:38 +0000
- Subject: [Bug target/58065] ARM MALLOC_ABI_ALIGNMENT is wrong
- Auto-submitted: auto-generated
- References: <bug-58065-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58065
David Abdurachmanov <david.abdurachmanov at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |david.abdurachmanov at gmail dot c
| |om
--- Comment #5 from David Abdurachmanov <david.abdurachmanov at gmail dot com> ---
malloc() [glibc implementation] default alignment is sizeof(long double) or 2 *
sizeof(size_t) if I remember correctly, which is 8 bytes for ARMv7. I think,
based on C and C++ standard you have to make sure that alignment is good for
whatever primitive type, which means alignment size being the size of the
biggest primitive type (long double).
Reference bug ticket(9 years old):
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15795
Quote from C standard (identical or similar exist in C++):
The pointer returned if the allocation succeeds is suitably aligned so that
it may be assigned to a pointer to any type of object and then used to
access such an object or an array of such objects in the space allocated
(until the space is explicitly deallocated).