This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: set_mem_attributes_minus_bitpos vs. size
On Tue, Sep 17, 2002 at 12:03:34PM +0930, Alan Modra wrote:
> On Mon, Sep 16, 2002 at 07:19:31PM +0200, Ulrich Weigand wrote:
> > expand_assignment then calls set_mem_attributes_minus_bitpos_size,
> > which adjusts this target MEM to
> > (mem/s:BLK (reg/f:SI 40) [5 pty.t+-40 S44 A64])
> > which has the size already reduced to the size of a struct termios.
>
> Isn't this the real bug? ie. pty.t-40 refers to the parent struct,
> so the size should be left as that of the parent struct.
I agree. Fixed thus.
r~
* emit-rtl.c (set_mem_attributes_minus_bitpos): Adjust SIZE
as well as OFFSET for BITPOS.
Index: emit-rtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/emit-rtl.c,v
retrieving revision 1.294
diff -c -p -d -r1.294 emit-rtl.c
*** emit-rtl.c 16 Sep 2002 16:36:32 -0000 1.294
--- emit-rtl.c 17 Sep 2002 04:13:25 -0000
*************** set_mem_attributes_minus_bitpos (ref, t,
*** 1885,1893 ****
}
/* If we modified OFFSET based on T, then subtract the outstanding
! bit position offset. */
if (apply_bitpos)
! offset = plus_constant (offset, -(apply_bitpos / BITS_PER_UNIT));
/* Now set the attributes we computed above. */
MEM_ATTRS (ref)
--- 1885,1898 ----
}
/* If we modified OFFSET based on T, then subtract the outstanding
! bit position offset. Similarly, increase the size of the accessed
! object to contain the negative offset. */
if (apply_bitpos)
! {
! offset = plus_constant (offset, -(apply_bitpos / BITS_PER_UNIT));
! if (size)
! size = plus_constant (size, apply_bitpos / BITS_PER_UNIT);
! }
/* Now set the attributes we computed above. */
MEM_ATTRS (ref)