public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hjl.tools at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/56726] i386: MALLOC_ABI_ALIGNMENT is too small (usually)
Date: Mon, 25 Mar 2013 20:04:00 -0000	[thread overview]
Message-ID: <bug-56726-4-tOt36CYe3E@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-56726-4@http.gcc.gnu.org/bugzilla/>


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56726

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hjl.tools at gmail dot com

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> 2013-03-25 20:04:44 UTC ---
(In reply to comment #0)
> 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)
> +

This isn't correct for x32, whose pointer size is 4 bytes with malloc
aligned to 16 bytes.


  reply	other threads:[~2013-03-25 20:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-25 19:11 [Bug target/56726] New: " chip at pobox dot com
2013-03-25 20:04 ` hjl.tools at gmail dot com [this message]
2013-03-25 21:35 ` [Bug target/56726] " 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-56726-4-tOt36CYe3E@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).