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

            Bug ID: 65055
           Summary: Types and variables differ in handling of multiple
                    instances of attribute aligned
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hstong at ca dot ibm.com

When multiple instances of the aligned attribute are applied to the same
entity, the handling for types uses the last value whereas the handling for
variables uses the most restrictive value.

Clang uses the most restrictive value (which seems to make sense) for both
cases.

### SOURCE (<stdin>):
struct __attribute__ ((aligned(32), aligned(16) )) A
{
} __attribute__ ((aligned(32), aligned(16) ));

extern int x __attribute__ ((aligned(32), aligned(16) ));

extern int chk[32];
extern int chk[__alignof__(x)];
extern int chk[__alignof__(struct A)];


### COMPILER INVOCATION:
gcc -c -xc++ -


### ACTUAL OUTPUT:
<stdin>:9:37: error: conflicting declaration 'int chk [16]'
<stdin>:8:12: note: previous declaration as 'int chk [32]'


### EXPECTED OUTPUT:
(Clean compile)


### COMPILER VERSION INFO:
Using built-in specs.
COLLECT_GCC=/usr/local/gcc-head/bin/gcc
COLLECT_LTO_WRAPPER=/usr/local/gcc-head/libexec/gcc/x86_64-unknown-linux-gnu/5.0.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /home/heads/gcc/gcc-source/configure
--prefix=/usr/local/gcc-head --enable-languages=c,c++ --enable-lto
--disable-multilib --without-ppl --without-cloog-ppl --enable-checking=release
--disable-nls
Thread model: posix
gcc version 5.0.0 20150212 (experimental) (GCC)

Reply via email to