https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89195

--- Comment #4 from Wilco <wilco at gcc dot gnu.org> ---
(In reply to Segher Boessenkool from comment #3)
> (In reply to Wilco from comment #1)
> > len is unsigned HOST_WIDE_INT, so bits_to_bytes_round_down does an unsigned
> > division...
> 
> That shouldn't make a difference though, both dividend and divisor should be
> non-negative.  Are they?  Well I guess not...  So pos points outside of the
> register here?!

pos is a frame offset so always negative. And yes this code is then creating an
access outside the original object (starting at -1 or +1 depending on
endianness).

> Was it correct before that?  At least it was symmetric so it *seemed* 
> correct..

It was broken in the same way. If I cast just len to HOST_WIDE_INT it works
fine.

Reply via email to