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: unassig...@gcc.gnu.org

        ReportedBy: bro...@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

Reply via email to