This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Does malloc tell us anything about alignment modulo k?
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Richard Kenner <kenner at vlsi1 dot ultra dot nyu dot edu>
- Cc: law at redhat dot com, gcc at gcc dot gnu dot org
- Date: Thu, 15 Jul 2004 14:43:15 +0200
- Subject: Re: Does malloc tell us anything about alignment modulo k?
- References: <10407151454.AA03178@vlsi1.ultra.nyu.edu>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Thu, Jul 15, 2004 at 10:54:16AM -0400, Richard Kenner wrote:
> You can assume the return value from malloc is aligned to
> BIGGEST_ALIGNMENT. GCC has done this for some time.
>
> Unfortunately, it's not correct on many systems. x86 comes to mind here.
Yeah, on i386-linux, M$ Win too (but not sure what cygwin/mingw malloc does)
and ppc-linux at least this assumption is not true.
Safer would be MIN (BIGGEST_ALIGNMENT, 2 * BITS_PER_WORD).
Jakub