https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114217
--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> --- BTW, with compilers from the last decade or so, it would be much better idea to just use standard memcpy for get_unaligned/put_unaligned rather than messing around with pointers to packed types. The compiler should optimize it correctly to unaligned loads or stores itself when one operand is cast from pointer to certain integral type and the size is the size of that type. Sure, you'd need to still use the GNU ({ ... }) extension #define __get_unaligned_t(type, ptr) ({ \ type __get_unaligned_t_x; \ memcpy(&__get_unaligned_t_x, (ptr), sizeof (__get_unaligned_t_x)); \ __get_unaligned_t_x; \ }) For the get_unaligned from structure element you'd then have something like get_unaligned_member(type, member, ptr) macro where it would use typeof (((type *)0)->member) and offsetof (type, member) and memcpy.