https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53037
--- Comment #30 from H. Peter Anvin <hpa at zytor dot com> --- On August 18, 2017 3:52:12 PM CDT, "hjl.tools at gmail dot com" <gcc-bugzi...@gcc.gnu.org> wrote: >https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53037 > >--- Comment #29 from H.J. Lu <hjl.tools at gmail dot com> --- >(In reply to r...@cebitec.uni-bielefeld.de from comment #28) >> > --- Comment #27 from H.J. Lu <hjl.tools at gmail dot com> --- >> >> > What are error messages? >> >> None, the warnings are simply missing. >> >> Rainer > >Sparc defines STRICT_ALIGNMENT which leads to > > unsigned mode_align = GET_MODE_ALIGNMENT (TYPE_MODE (type)); > > /* Don't override a larger alignment requirement coming from a user > alignment of one of the fields. */ > if (mode_align >= TYPE_ALIGN (type)) > { > SET_TYPE_ALIGN (type, mode_align); > TYPE_USER_ALIGN (type) = 0; > } > >so __attribute__ ((packed)) is basically ignored on Sparc. This patch > >diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c >index 3028d55773a..6dd605810ac 100644 >--- a/gcc/stor-layout.c >+++ b/gcc/stor-layout.c >@@ -1784,7 +1784,7 @@ finalize_type_size (tree type) > > /* Don't override a larger alignment requirement coming from a user > alignment of one of the fields. */ >- if (mode_align >= TYPE_ALIGN (type)) >+ if (mode_align > TYPE_ALIGN (type)) > { > SET_TYPE_ALIGN (type, mode_align); > TYPE_USER_ALIGN (type) = 0; > >works with cross compiler. But I have no idea if it is correct. Ignoring __attribute__((packed)) I would consider to be a super serious error.