Message ID | alpine.LNX.2.00.1301151548230.6889@zhemvz.fhfr.qr |
---|---|
State | New |
Headers | show |
> Not necessarily. The following is a 4.7 variant of the patch > (on trunk get_object_alignment_1 got one extra output which > moved the align return value to by-reference). OK, I obviously didn't try very hard here... > Can you give it testing on the branch and a strict-align target? > > Thanks, > Richard. > > 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. Bootstrapped/regtested on 4.7 branch for SPARC/Solaris, all clear.
On Wed, 16 Jan 2013, Eric Botcazou wrote: > > Not necessarily. The following is a 4.7 variant of the patch > > (on trunk get_object_alignment_1 got one extra output which > > moved the align return value to by-reference). > > OK, I obviously didn't try very hard here... > > > Can you give it testing on the branch and a strict-align target? > > > > Thanks, > > Richard. > > > > 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. > > Bootstrapped/regtested on 4.7 branch for SPARC/Solaris, all clear. Thanks, committed on the branch as well. The situation with the MEM_REF block on trunk isn't all that bad, it can't result in bogus alignment as far as I can see. Thus I'll leave further cleanups to when stage1 opens again. Richard.
Index: gcc/emit-rtl.c =================================================================== --- gcc/emit-rtl.c (revision 195201) +++ 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; + obj_align = get_object_alignment_1 (t, &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); } }