diff options
author | Richard Biener <rguenther@suse.de> | 2013-01-15 12:48:13 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2013-01-15 12:48:13 +0000 |
commit | 783a3a053465d7f68b3bb5ae5bee631ea6297fa5 (patch) | |
tree | 1285f6af29343afca7779573367cc057aec760b6 /gcc/emit-rtl.c | |
parent | 3a579e0930abe3ed91977a71284021399339860c (diff) | |
download | gcc-783a3a053465d7f68b3bb5ae5bee631ea6297fa5.tar.gz |
re PR middle-end/55882 (unaligned load/store : incorrect struct offset)
2013-01-15 Richard Biener <rguenther@suse.de>
PR middle-end/55882
* emit-rtl.c (set_mem_attributes_minus_bitpos): Correctly
account for bitpos when computing alignment.
* gcc.dg/torture/pr55882.c: New testcase.
From-SVN: r195194
Diffstat (limited to 'gcc/emit-rtl.c')
-rw-r--r-- | gcc/emit-rtl.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index e7e904a040b..2987bc9bb88 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -1839,7 +1839,12 @@ set_mem_attributes_minus_bitpos (rtx ref, tree t, int objectp, 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 - bitpos) & (obj_align - 1); + if (obj_bitpos != 0) + obj_align = (obj_bitpos & -obj_bitpos); attrs.align = MAX (attrs.align, obj_align); } } |