[Bug c/53037] warn_if_not_aligned(X)
hjl.tools at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sat Aug 19 08:23:00 GMT 2017
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 ro@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.
More information about the Gcc-bugs
mailing list