From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27860 invoked by alias); 15 Feb 2013 06:59:28 -0000 Received: (qmail 27809 invoked by uid 48); 15 Feb 2013 06:59:07 -0000 From: "brooks at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/56337] New: __attribute__((aligned(N))) allows too-high values of N Date: Fri, 15 Feb 2013 06:59:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Keywords: X-Bugzilla-Severity: minor X-Bugzilla-Who: brooks at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 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 X-SW-Source: 2013-02/txt/msg01522.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56337 Bug #: 56337 Summary: __attribute__((aligned(N))) allows too-high values of N Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: minor Priority: P3 Component: c AssignedTo: unassigned@gcc.gnu.org ReportedBy: brooks@gcc.gnu.org This is a pretty minor thing, but consider the following .c file, which defines four arrays with very high alignments: float __attribute__((aligned(1<<25))) a[128]; float __attribute__((aligned(1<<26))) b[128]; float __attribute__((aligned(1<<27))) c[128]; float __attribute__((aligned(1<<28))) d[128]; For the smaller three alignments, the .comm directive in the assembly is correct. However, for the alignment of 1<<28, the alignment entry goes wildly wrong: $ i686-pc-linux-gnu-gcc -O2 -S align6.c -o- .file "align6.c" .comm d,512,4026531840 .comm c,512,134217728 .comm b,512,67108864 .comm a,512,33554432 .ident "GCC: (GNU) 4.8.0 20130131 (experimental)" .section .note.GNU-stack,"",@progbits This is probably a pretty minor bug; it seems unlikely to arise in real practice. I'm only filing it because I expect the solution is likewise trivial -- if we try an alignment of 1<<29, we get an error of "requested alignment is too large". The threshold for this error merely needs to be lowered by a factor of two. This patch from H.J. Lu on bug 39323 appears to be the relevant code in gcc/config/elfos.h, although that hunk of the patch was never applied: http://gcc.gnu.org/ml/gcc-patches/2009-02/msg01274.html