public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/56726] New: i386: MALLOC_ABI_ALIGNMENT is too small (usually)
@ 2013-03-25 19:11 chip at pobox dot com
  2013-03-25 20:04 ` [Bug target/56726] " hjl.tools at gmail dot com
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: chip at pobox dot com @ 2013-03-25 19:11 UTC (permalink / raw)
  To: gcc-bugs


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


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2015-04-06 16:28 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-25 19:11 [Bug target/56726] New: i386: MALLOC_ABI_ALIGNMENT is too small (usually) chip at pobox dot com
2013-03-25 20:04 ` [Bug target/56726] " hjl.tools at gmail dot com
2013-03-25 21:35 ` chip at pobox dot com
2013-03-25 22:07 ` hjl.tools at gmail dot com
2013-03-25 22:36 ` chip at pobox dot com
2013-03-26 14:27 ` rguenth at gcc dot gnu.org
2013-03-29  6:05 ` chip at pobox dot com
2013-09-05 20:05 ` chip at pobox dot com
2014-06-12 17:11 ` chip at pobox dot com
2015-04-02 11:36 ` fweimer at redhat dot com
2015-04-02 11:53 ` jakub at gcc dot gnu.org
2015-04-02 21:48 ` chip at pobox dot com
2015-04-06 16:28 ` fweimer at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).