public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/56337] New: __attribute__((aligned(N))) allows too-high values of N
@ 2013-02-15  6:59 brooks at gcc dot gnu.org
  2013-02-15  7:07 ` [Bug c/56337] __attribute__((aligned(N))) breaks for N=1<<28 brooks at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: brooks at gcc dot gnu.org @ 2013-02-15  6:59 UTC (permalink / raw)
  To: gcc-bugs


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-08-31  6:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-15  6:59 [Bug c/56337] New: __attribute__((aligned(N))) allows too-high values of N brooks at gcc dot gnu.org
2013-02-15  7:07 ` [Bug c/56337] __attribute__((aligned(N))) breaks for N=1<<28 brooks at gcc dot gnu.org
2013-02-15  9:26 ` rguenth at gcc dot gnu.org
2021-07-23 17:14 ` [Bug middle-end/56337] " pinskia at gcc dot gnu.org
2021-07-23 17:20 ` [Bug target/56337] " pinskia at gcc dot gnu.org
2021-07-23 20:33 ` pinskia at gcc dot gnu.org
2021-08-31  6:29 ` cvs-commit at gcc dot gnu.org
2021-08-31  6:30 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).