public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/65055] New: Types and variables differ in handling of multiple instances of attribute aligned
@ 2015-02-13 17:57 hstong at ca dot ibm.com
  2024-04-06  8:13 ` [Bug c++/65055] Types and variables differ in handling of multiple instances of attribute aligned/alignas pinskia at gcc dot gnu.org
  2024-04-06  8:15 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: hstong at ca dot ibm.com @ 2015-02-13 17:57 UTC (permalink / raw)
  To: gcc-bugs

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)


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/65055] Types and variables differ in handling of multiple instances of attribute aligned/alignas
  2015-02-13 17:57 [Bug c++/65055] New: Types and variables differ in handling of multiple instances of attribute aligned hstong at ca dot ibm.com
@ 2024-04-06  8:13 ` pinskia at gcc dot gnu.org
  2024-04-06  8:15 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-06  8:13 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2018-09-14 00:00:00         |2024-4-6
            Summary|Types and variables differ  |Types and variables differ
                   |in handling of multiple     |in handling of multiple
                   |instances of attribute      |instances of attribute
                   |aligned                     |aligned/alignas

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed even using standard C++11 style attributes/alingof fails:
```
struct alignas(32) alignas(16) A {} ;

extern int x alignas(32) alignas(16);

extern int chk[32];
extern int chk[alignof(struct A)];
```

Which works with clang, MSVC and EDG.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/65055] Types and variables differ in handling of multiple instances of attribute aligned/alignas
  2015-02-13 17:57 [Bug c++/65055] New: Types and variables differ in handling of multiple instances of attribute aligned hstong at ca dot ibm.com
  2024-04-06  8:13 ` [Bug c++/65055] Types and variables differ in handling of multiple instances of attribute aligned/alignas pinskia at gcc dot gnu.org
@ 2024-04-06  8:15 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-06  8:15 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|NEW                         |RESOLVED

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup.

*** This bug has been marked as a duplicate of bug 64236 ***

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-04-06  8:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-13 17:57 [Bug c++/65055] New: Types and variables differ in handling of multiple instances of attribute aligned hstong at ca dot ibm.com
2024-04-06  8:13 ` [Bug c++/65055] Types and variables differ in handling of multiple instances of attribute aligned/alignas pinskia at gcc dot gnu.org
2024-04-06  8:15 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).