This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch]: new returns misaligned pointers
On Fri, Nov 12, 1999 at 03:52:37PM -0800, Mark Mitchell wrote:
> Makes sense. Could you mention for which ports this makes a
> difference? If it does make a difference with an existing port...
Of the existing live ports,
arm/arm.h:#define BIGGEST_ALIGNMENT 32
arm/thumb.h:#define BIGGEST_ALIGNMENT 32
c4x/c4x.h:#define BIGGEST_ALIGNMENT 32
fr30/fr30.h:#define BIGGEST_ALIGNMENT 32
i386/cygwin.h:#define BIGGEST_ALIGNMENT 128
i960/i960.h:#define BIGGEST_ALIGNMENT 128
m32r/m32r.h:#define BIGGEST_ALIGNMENT 32
m68k/news.h:#define BIGGEST_ALIGNMENT 32
mn10200/mn10200.h:#define BIGGEST_ALIGNMENT 16
mn10300/mn10300.h:#define BIGGEST_ALIGNMENT 32
ns32k/ns32k.h:#define BIGGEST_ALIGNMENT 32
rs6000/sysv4.h:#define BIGGEST_ALIGNMENT ((TARGET_EABI) ? 64 : 128)
sh/sh.h:#define BIGGEST_ALIGNMENT (TARGET_ALIGN_DOUBLE ? 64 : 32)
sparc/sparc.h:#define BIGGEST_ALIGNMENT (TARGET_ARCH64 ? 128 : 64)
v850/v850.h:#define BIGGEST_ALIGNMENT 32
vax/vax.h:#define BIGGEST_ALIGNMENT 32
Of the 16, 11 have BIGGEST_ALIGNMENT smaller than `double', and
4 have BIGGEST_ALIGNMENT larger, for a 128-bit `long double'.
SH has special problems due to -malign-double affecting things.
I hadn't realized there were quite so many victims of change.
It's up to someone C++-ish to decide if breaking the ABI for
those defining BIGGEST_ALIGNMENT smaller than `double' is a
reasonable thing to do. For the four ports that have a large
`long double' things are clearly already broken.
Might I suggest, if we're going to decide to break things,
that instead of changing to always using BIGGEST_ALIGNMENT,
that we use the alignment of the type being allocated? Seems
like that way we'd avoid wasting little bits of memory
unnecessarily.
r~