[Bug tree-optimization/101335] [12 Regression] wrong code at -O2 and above (casts between signed and unsigned) by r12-1796

amacleod at redhat dot com gcc-bugzilla@gcc.gnu.org
Mon Jul 12 15:35:21 GMT 2021


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

--- Comment #2 from Andrew Macleod <amacleod at redhat dot com> ---
yeah, it because we have been treating casts to objects of the same precision
as equivalences.    This normally works fine, but in this case we have
c_9 = (int)_2          c_9 == _2
_3 = c_9 - 10      so  _3 is < c_9
d_10 = (unsigned)_3    d_10 == _3 

if (_2 < d_10)
with the equivalences, it now thinks that d_10 < _2.

So I have to either not allow compounding relations thru casting equivalences
(painful), or something else.

-fwrapv make its work because we don't register the relation _3 < c_9 if
wrapping is on.


I'm running an experiment... When the recomputation code was introduced, it
completely eliminated the need to track downcasts. It seems that removing all
equivalences between casts doesn't miss anything either, so perhaps this older
bit isn't needed anymore.

I'm running it thru the testsuite now...


More information about the Gcc-bugs mailing list