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

--- Comment #24 from Sven <sven.koehler at gmail dot com> ---
Comment #4 mentions typedef int myint __attribute__((aligned(1)));
That shouldn't even work. The GCC documentation on Type Attributes mentions
that "The aligned attribute can only increase the alignment". It goes on to
mention the packed attribute, which can be used to decrease alignment. But as
far as I know, that attributes was designed for structs. Anyhow, it seems that
the aligned attribute is intended for increasing the alignment only - not for
decreasing.

Yet, when I checked __alignof(myint) with both gcc and clang, it was in fact
decreased from 4 to 1. Not sure why. That seems to contradict the
documentation.

Reply via email to