Hi,

With a port of GCC 4.2.1 I'm working on, get_pointer_alignment() (via
DECL_ALIGN) returns different values for a char array depending upon whether
it is on the stack or not.

For example, if the array is a global, get_pointer_alignment() always
returns 32, regardless, if there are more than 4 elements in the array. This
is good.

However, when the array is a local, get_pointer_alignment() returns either
8, 16, or 32, depending upon the size size of the array. i.e. if the array
has 11 elements, get_pointer_alignment() will return 8, if it has 16
elements, it will return 32.

This has the knock on consequence that inline memcpys aren't efficient as
they could be (i.e. I end up with byte-by-byte copies instead of word at a
time) for arrays with an odd number of elements.

How can I ensure alignment when allocating on the stack? The DATA_ALIGNMENT
macro doesn't seem to be having the desired effect in this case. (1I don't
even see varasm.c:align_variable being called, so it's not being used).

Cheers,
Jon



Reply via email to