This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Char array alignment for PowerPc changed
- From: Michael Eager <eager at eagercon dot com>
- To: GCC <gcc at gcc dot gnu dot org>
- Date: Tue, 16 Jan 2007 20:04:38 -0800
- Subject: Char array alignment for PowerPc changed
With powerpc-eabi-gcc, I noticed that there's been a small
change between gcc-3.4 and gcc-4.1 in how automatic char arrays
are allocated.
In gcc-3.4, char arrays are aligned on word boundaries.
In gcc-4.1, they are aligned on byte boundaries.
For example:
void foo() {
char a[31];
char b[31];
...
On gcc-3.4, "b" would be allocated at a+32; in gcc-4.1, it's a+31.
I can't find a bug report which mentions this, nor
do I see anything in the code either in function.c or
in the LOCAL_ALIGNMENT macro in rs6000.h which would
have this effect.
Was this a deliberate change? If so, where?
The PPC EABI says that arrays are aligned on the boundary
of the type, which suggests that this was a bug fix. But
unaligned char arrays make strcpy much slower.
--
Michael Eager eager@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306 650-325-8077