This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/55882] unaligned load/store : incorrect struct offset


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);
        }
     }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]