From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 804 invoked by alias); 13 Feb 2015 17:57:13 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 643 invoked by uid 48); 13 Feb 2015 17:57:09 -0000 From: "hstong at ca dot ibm.com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/65055] New: Types and variables differ in handling of multiple instances of attribute aligned Date: Fri, 13 Feb 2015 17:57:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 5.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: hstong at ca dot ibm.com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-02/txt/msg01526.txt.bz2 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 (): 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: :9:37: error: conflicting declaration 'int chk [16]' :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)