https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36566
Eric Estievenart <steve+gcc at tecwec dot eu> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |steve+gcc at tecwec dot eu --- Comment #14 from Eric Estievenart <steve+gcc at tecwec dot eu> --- What about: struct S { int i; } __attribute__((__packed__)) __attribute((aligned(8))); void f( S* s ) { int& i = s->i; // Error here } S::i is obviously properly aligned, the compiler should know it and accept the referencing. As for the argument 'the field might be unaligned and this would violate... and crash...', I donĀ“t really agree. The compiler knows the arch, the alignment, and it can decide: - to emit an error if unaligned(or unknown) if alignment required by arch - to emit a warning on other arch Note by the way that this seems accepted by clang...