This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/82914] 'struct __attribute__ ((aligned (N))) s' ignores 'aligned' attribute
- From: "egallager at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 21 May 2018 04:42:26 +0000
- Subject: [Bug c/82914] 'struct __attribute__ ((aligned (N))) s' ignores 'aligned' attribute
- Auto-submitted: auto-generated
- References: <bug-82914-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82914
--- Comment #7 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Martin Sebor from comment #5)
> (In reply to Paul Eggert from comment #4)
> > Here, GCC says the alignment of 'b' is 1, not 8. What happened to the
> > attribute?
>
> GCC silently drops it, without validating it. For instance, this is
> accepted as well:
>
> struct s { char mem; };
>
> struct __attribute__ ((foobar))
> s b;
>
> I view it as a bug. At a minimum, GCC should point out that it's ignoring
> the attribute like other compilers do, such as Clang:
>
> warning: unknown attribute 'foobar' ignored [-Wunknown-attributes]
>
> I happened to notice this bug while testing a fix for pr84108. It seems
> that a simple fix is fairly straightforward so hopefully Richard won't be
> offended if I reopen this bug, assign it to myself, and submit my patch in
> stage 1 of GCC 9.
It's stage 1 of gcc 9 now.