https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92712
--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to Marc Glisse from comment #8) > (In reply to Jakub Jelinek from comment #6) > > The suggestion I'll try to work on is to check if C isn't a plus/minus expr > > with constant second operand that doesn't go in the other direction and thus > > where the transformation isn't introducing UB. > > In the testcase, t-1 is computed in some unsigned type and then cast back to > signed, so I don't think it will work. I know, it will be a small complication, sure, but it can be handled. Using range info is certainly useful, but e.g. for this case with -1U it will not be able to do anything, as the range of (int)(t-1U) will be varying. So I think we want both.