[Bug rtl-optimization/89195] [7/8/9 regression] Corrupted stack offset after combine

wilco at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Feb 5 10:25:00 GMT 2019


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.


More information about the Gcc-bugs mailing list