From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30171 invoked by alias); 16 Jul 2013 15:32:26 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 26894 invoked by uid 48); 16 Jul 2013 15:30:24 -0000 From: "yann at droneaud dot fr" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/57908] alignment of arrays allocated stack on amd64/x86_64: 16 bytes ? Date: Tue, 16 Jul 2013 15:32:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: yann at droneaud dot fr X-Bugzilla-Status: RESOLVED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-07/txt/msg00793.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57908 --- Comment #8 from Yann Droneaud --- 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.