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

egallager at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon May 21 04:42:00 GMT 2018


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.


More information about the Gcc-bugs mailing list