From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21337 invoked by alias); 25 Mar 2013 19:11:04 -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 21294 invoked by uid 48); 25 Mar 2013 19:10:55 -0000 From: "chip at pobox dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/56726] New: i386: MALLOC_ABI_ALIGNMENT is too small (usually) Date: Mon, 25 Mar 2013 19:11:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: chip at pobox 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-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 X-SW-Source: 2013-03/txt/msg01822.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56726 Bug #: 56726 Summary: i386: MALLOC_ABI_ALIGNMENT is too small (usually) Classification: Unclassified Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassigned@gcc.gnu.org ReportedBy: chip@pobox.com Observed malloc alignment for the i386 ABI is double POINTER_SIZE. BITS_PER_WORD, the current default, is usually too small. (It's right only on X32.) Proposed patch: --- gcc/config/i386/i386.h (revision 197055) +++ gcc/config/i386/i386.h (working copy) @@ -815,6 +815,14 @@ x86_field_alignment (FIELD, COMPUTED) #endif +/* The maximum alignment 'malloc' honors. + + This value is taken from glibc documentation for memalign(). It may + be up to double the very conservative GCC default. This should be safe, + since even the GCC 4.8 default of BIGGEST_ALIGNMENT usually worked. */ + +#define MALLOC_ABI_ALIGNMENT (POINTER_SIZE * 2) + /* If defined, a C expression to compute the alignment given to a constant that is being placed in memory. EXP is the constant and ALIGN is the alignment that the object would ordinarily have