[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:32:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57908
--- Comment #8 from Yann Droneaud <yann at droneaud dot fr> ---
Using -Os show different results:
Arrays
object | u8_0 | 0x7fff9b4c05bc | 1 | 4 | 1
object | u8_1 | 0x7fff9b4c05c7 | 3 | 1 | 1
object | u8_2 | 0x7fff9b4c05da | 7 | 2 | 1
object | u8_3 | 0x7fff9b4c05d0 | 5 | 16 | 1
object | u8_4 | 0x7fff9b4c05bf | 2 | 1 | 1
object | u8_5 | 0x7fff9b4c05bd | 1 | 1 | 1
object | u8_6 | 0x7fff9b4c05ca | 3 | 2 | 1
object | u8_7 | 0x7fff9b4c05d5 | 5 | 1 | 1
object | u8_8 | 0x7fff9b4c05e1 | 7 | 1 | 1
object | u8_9 | 0x7fff9b4c05c1 | 2 | 1 | 1
object | u8_10 | 0x7fff9b4c05e8 | 11 | 8 | 1
object | u8_11 | 0x7fff9b4c05cd | 3 | 1 | 1
object | u8_12 | 0x7fff9b4c05f3 | 13 | 1 | 1
object | u8_13 | 0x7fff9b4c05c3 | 2 | 1 | 1
object | u8_14 | 0x7fff9b4c05be | 1 | 2 | 1
object | u8_15 | 0x7fff9b4c05c5 | 2 | 1 | 1
So GCC is using 16 bytes to align array allocated on stack by default but it's
not enforcing such alignment.
I guess it's all about optimisation ... but wasting up to 14 bytes to get an
array of 2 bytes aligned might be overkill.
Could someone comment on which optimisation is achieved by aligning such small
arrays ?
Regards.
More information about the Gcc-bugs
mailing list