From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18455 invoked by alias); 3 Aug 2013 22:46:41 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 18389 invoked by uid 48); 3 Aug 2013 22:46:39 -0000 From: "david.abdurachmanov at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/58065] ARM MALLOC_ABI_ALIGNMENT is wrong Date: Sat, 03 Aug 2013 22:46:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: david.abdurachmanov at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-08/txt/msg00223.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58065 David Abdurachmanov changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |david.abdurachmanov at gmail dot c | |om --- Comment #5 from David Abdurachmanov --- 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).