[Bug c++/92045] New: [7 8 9 10 regression][C++11] valid alignas ignored with spurious warning

wilco at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Oct 10 11:17:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92045

            Bug ID: 92045
           Summary: [7 8 9 10 regression][C++11] valid alignas ignored
                    with spurious warning
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: wilco at gcc dot gnu.org
  Target Milestone: ---

Since GCC7 alignas no longer works correctly if the requested alignment is
larger than MAX_STACK_ALIGNMENT (which is 8 or 16 on most targets). This is
incorrect since the equivalent attribute aligned does the right thing.

#include <array>

int f1(int x)
{
  __attribute((aligned (64))) int arr[10];
  return arr[x];
}

int f2(int x)
{
  alignas(64) int arr[10];
  return arr[x];
}

align.c: In function 'int f2(int)':
align.c:11:25: warning: requested alignment 64 is larger than 16 [-Wattributes]
   alignas(64) int arr[10];


More information about the Gcc-bugs mailing list