https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68816
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- Since GCC isn't a static analyzer, and there is no overflow in your example to detect, it's unsurprising (to me) that there's no diagnostic. I assume you're asking for the anti-pattern to be recognized and a "condition is always false" warning issued, rather than silently assuming the condition is always true and removing the check?