This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/55882] unaligned load/store : incorrect struct offset
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 08 Jan 2013 15:54:46 +0000
- Subject: [Bug c/55882] unaligned load/store : incorrect struct offset
- Auto-submitted: auto-generated
- References: <bug-55882-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55882
--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> 2013-01-08 15:54:46 UTC ---
Or more correct
Index: gcc/emit-rtl.c
===================================================================
--- gcc/emit-rtl.c (revision 195014)
+++ gcc/emit-rtl.c (working copy)
@@ -1839,7 +1839,12 @@ set_mem_attributes_minus_bitpos (rtx ref
if (!align_computed)
{
- unsigned int obj_align = get_object_alignment (t);
+ unsigned int obj_align;
+ unsigned HOST_WIDE_INT obj_bitpos;
+ get_object_alignment_1 (t, &obj_align, &obj_bitpos);
+ obj_bitpos = (obj_bitpos + apply_bitpos) & (obj_align - 1);
+ if (obj_bitpos != 0)
+ obj_align = (obj_bitpos & -obj_bitpos);
attrs.align = MAX (attrs.align, obj_align);
}
}