https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86891
--- Comment #5 from Wilco <wilco at gcc dot gnu.org> --- (In reply to Richard Earnshaw from comment #4) > Yes, the extension should be zero-extend, not sign extend. The plus > operation is correct, however, since decrementing the first operand could > lead to underflow if it was zero. So the correct rtl would be > > (compare ((zero_x(a)) (plus (zero_x(b) (ltu(cc, 0))))) > (minus (...)) Agreed. The issue is more widespread though, signed underflow doesn't work either, and subv<mode>4 simply uses gen_sub<mode>3_compare1 which does do a normal compare, so the RTL does not compute the overflow flag eventhough the actual compare does. It seems like a bug when it does constant fold this RTL given it should have been folded before expand. Using UNSPEC for these complex flag uses may be best to be safe.