Subject: Re: Another ELF issue
To: David Laight <>
From: Richard Earnshaw <>
List: port-arm
Date: 02/14/2002 19:41:53
> I don't see how knowing that malloc() returns an 8 byte (or greater)
> aligned pointer helps the compiler unless it knows that (almost)
> all 8 byte items are aligned.

It doesn't hugely.  However, if the compiler can track the lifetime of a 
value returned by malloc, and it knows the alignment of that pointer, then 
it can make use of that.  Further, you can use extensions that over-align 
some objects, such as

double a __attribute__((aligned(8)));

or what-ever the syntax is.  That variable will then maintain 8-byte 
alignment and the compiler can make use of that.

> The procedure calling convention is problematical, especially for
> var-args functions and printf() - is the format string required to
> use all the arguments?

No. But it must un-marshall them from left-to-right along the statement 
that created the var-args call.

> If the stack is aligned, then the compiler knows the alignment of fp
> parameters.  If they are misaligned and their address is taken then
> then presumably an aligned copy must be made.
> Can you take the address of a varags parameter?

I don't see why not.

> > 
> > > Maybe gcc should issue a warning whenever it misaligns items within
> > > a structure?  Can it remember which items ought to be aligined?
> > 
> > I don't think that would be sensible either.
> What does --strict-align do?

Never heard of it.