https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53037
--- Comment #20 from Martin Sebor <msebor at gcc dot gnu.org> --- It would be useful to have the ability to trigger a warning when an object of a type with an explicitly specified alignment (even if the alignment matches its own native one) is defined in a way that would cause its alignment to be reduced. The specific use case where it came up is defining a packed struct that contains a member of type std::mutex (or some type that contains it.) A test case for the warning I was asking about (with no warn_if_not_aligned attribute) is simply: struct __attribute___ ((aligned (8))) S8 { char a[8]; }; // explicitly overaligned struct __attribute__ ((packed)) S { struct S8 s8; // warn here: alignment of 'struct A' reduced from 8 to 1 };