The testcase I'm about to attach generates a bug error at runtime on the SPARC (and very likely on any other STRICT_ALIGNMENT target). Verified with 2.95.3, 3.3.x, 3.4.x and 4.0pre.
I think the front-end wrongly turns ADDR_EXPR<COMPONENT_REF<INDIRECT_REF>> into PLUS_EXPR whatever the alignment of the field. For reference, the Ada front-end doesn't do the simplification and lets the middle-end generate the temporary if required. -- Summary: Unaligned access to fields inside packed records Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: ebotcazou at gcc dot gnu dot org CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: *-*-* GCC host triplet: *-*-* GCC target triplet: *-*-* http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18287