https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53037
--- Comment #22 from Martin Sebor <msebor at gcc dot gnu.org> --- The warning on the test case in comment #21 looks good to me. Thanks! >From reading comment #1 I'm not sure your patch does quite what you described there. It doesn't warn on the declaration of the global object x below: typedef unsigned long long __u64 __attribute__((aligned(4), warn_if_not_aligned(8))); static char c; static __u64 x; even though x is 4-byte aligned. (It does warn when a __u64 member is declared in a packed struct.)