[Bug c/82914] New: 'struct __attribute__ ((aligned (N))) s' ignores 'aligned' attribute

eggert at gnu dot org gcc-bugzilla@gcc.gnu.org
Thu Nov 9 04:48:00 GMT 2017


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

            Bug ID: 82914
           Summary: 'struct __attribute__ ((aligned (N))) s' ignores
                    'aligned' attribute
           Product: gcc
           Version: 7.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: eggert at gnu dot org
  Target Milestone: ---

I'm reporting a GCC problem that caused Emacs to SIGSEGV as described here:

https://bugs.gnu.org/29183

I tracked the problem down to an '__attribute__ ((aligned (8)))' that GCC
silently ignored. To reproduce the problem, consider the following program:

  struct s { char mem; };
  __attribute__ ((aligned (8))) struct s a;
  struct __attribute__ ((aligned (8))) s b;
  struct s __attribute__ ((aligned (8))) c;
  struct s d __attribute__ ((aligned (8)));

Compile this with 'gcc -S' on x86-64, and you get:

        .comm   a,1,8
        .comm   b,1,1
        .comm   c,1,8
        .comm   d,1,8

Although the variables a, c, and d are properly aligned, the variable b is not:
the 'aligned' attribute is silently ignored for b.

I reproduced this problem with GCC 7.2.1 20170915 (Red Hat 7.2.1-2), running on
Fedora 26 x86-64.


More information about the Gcc-bugs mailing list