This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [patch]: new returns misaligned pointers


On Fri, Nov 12, 1999 at 05:14:51PM -0800, Richard Henderson wrote:
> On Fri, Nov 12, 1999 at 05:53:37PM -0700, Diego Novillo wrote:
> > But couldn't this still produce wrong alignments? What we really
> > want here is to align the header to the same alignment returned
> > by malloc().
> 
> And why do we want this?  The alignment returned by malloc
> in and of itself is nothing special.

Actually I disagree.  Malloc is required to return the maximum alignment
needed.  If your system specifies malloc returns 16-byte alignment, even
malloc(1) MUST return 16-byte alignment.  In some ABI's, they want malloc
returning more than you would get even with long double (presumably is to align
it on cache boundaries, or to guarantee instructions that need this alignment
that aren't part of C, such as locking type instructions can continue to work
with allocated memory)

> For the port in question, they have a 128-bit data type that
> needs to be properly aligned, which is more than the 64-bit
> alignment we'd been giving it.  Beyond that, I don't think
> there's a problem.
> 
> 
> r~

-- 
Michael Meissner, Cygnus Solutions
PMB 198, 174 Littleton Road #3, Westford, Massachusetts 01886
email: meissner@cygnus.com	phone: 978-486-9304	fax: 978-692-4482

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]