http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54167

             Bug #: 54167
           Summary: excessive alignment
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: drepper....@gmail.com


Compile the following code:

struct c
{
  int a, b;
  /*constexpr*/ c() : a(1), b(2) { }
};

c v;


The variable v will be defined with:

    .bss
    .align 16
    .type    v, @object
    .size    v, 8
v:
    .zero    8

The variable has alignment 16!

If you uncomment the constexpr and compile with -std=gnu++11 it can be seen
that the compiler does know what the correct alignment is:

    .globl    v
    .data
    .align 4
    .type    v, @object
    .size    v, 8
v:
    .long    1
    .long    2


This happens with the current svn version as well as with 4.7.0.

Reply via email to