https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90469
--- Comment #2 from J.A.H <prg.j.a.h at centrum dot cz> --- I agree that the code is based on some "undefined" expectations. However in another similar cases the compiler typically warns that it ignores integer overflow. The problem is that we are not able to find every "expected by programmer but ignored by compiler" overflow usage. It is a problem to teach programmers to avoid such constructs in a new code. As an indicator that the signed overflow is expected here would be used the unsigned conversion of the result. But yep, it is still undefined expectation. Anyway I understand that it may be hard to detect each false positive, but still I think that the compiler should produce "condition is always true/false" warning.