This fixes PR55882 - set_mem_attributes_minus_bitpos misses to account for the to-be applied bitpos when computing MEM_ALIGN. It extracts alignment from 't' instead of &t - bitpos.
Bootstrapped and tested on x86_64-unknown-linux-gnu, bootstrap and regtest running on mips. Does this look sensible? Thanks, Richard. 2013-01-09 Richard Biener <rguent...@suse.de> PR middle-end/55882 * emit-rtl.c (set_mem_attributes_minus_bitpos): Correctly account for the to-be applied bitpos when computing alignment. 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); } }