[Bug target/57908] alignment of arrays allocated stack on amd64/x86_64: 16 bytes ?
yann at droneaud dot fr
gcc-bugzilla@gcc.gnu.org
Tue Jul 16 15:18:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57908
Yann Droneaud <yann at droneaud dot fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|INVALID |---
--- Comment #5 from Yann Droneaud <yann at droneaud dot fr> ---
(In reply to Yann Droneaud from comment #4)
> (In reply to Andrew Pinski from comment #2)
> > Your test program is not fully testing things correctly.
> > kind name address size alignment required
> > > object | u8_5 | 0x7fffefdd4810 | 3 | 16 | 1
> > > object | u8_6 | 0x7fffefdd4800 | 2 | 2048 | 1
> > > object | u8_7 | 0x7fffefdd47ff | 1 | 1 | 1
> >
> > Shows why. There are two variables right next to each other but the
> > alignment recorded is 2048 but that was just accidental. The alignment of
> > u8_6 is 16 due to the next variable at 10.
>
> Have you noticed that u8_7 is an array of 1 element only ?
> Array of 1 element (bytes) only are not aligned on 16 bytes boundary.
> Array of 2 bytes and greater get aligned on 16 bytes boundary.
>
> Should I show another test case ?
kind name address size alignment required
type | uint8_t | N/A | 1 | N/A | 1
type | uint8_t[2] | N/A | 2 | N/A | 1
Arrays
object | u8_0 | 0x7fff7671e25f | 1 | 1 | 1
object | u8_1 | 0x7fff7671e250 | 3 | 16 | 1
object | u8_2 | 0x7fff7671e240 | 7 | 64 | 1
object | u8_3 | 0x7fff7671e230 | 5 | 16 | 1
object | u8_4 | 0x7fff7671e220 | 2 | 32 | 1
object | u8_5 | 0x7fff7671e21f | 1 | 1 | 1
object | u8_6 | 0x7fff7671e210 | 3 | 16 | 1
object | u8_7 | 0x7fff7671e200 | 5 | 512 | 1
object | u8_8 | 0x7fff7671e1f0 | 7 | 16 | 1
object | u8_9 | 0x7fff7671e1e0 | 2 | 32 | 1
object | u8_10 | 0x7fff7671e1d0 | 11 | 16 | 1
object | u8_11 | 0x7fff7671e1c0 | 3 | 64 | 1
object | u8_12 | 0x7fff7671e1b0 | 13 | 16 | 1
object | u8_13 | 0x7fff7671e1a0 | 2 | 32 | 1
object | u8_14 | 0x7fff7671e19f | 1 | 1 | 1
object | u8_15 | 0x7fff7671e190 | 2 | 16 | 1
More information about the Gcc-bugs
mailing list