https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119011
--- Comment #5 from Alejandro Colomar <alx at kernel dot org> --- (In reply to Jakub Jelinek from comment #4) > (In reply to Alejandro Colomar from comment #3) > > unsigned long == -1 does The Right Thing(tm). The -1 is first > > sign-extended, and afterwards converted, which is what programmers want. > > No, it is exactly something the warning should warn about. > If you want to compare against all ones time_t, just use ~(time_t)0 or > similar. I want to compare to -1 converted to type time_t, whether it is all-ones time_t or whatever other pattern. One's complement doesn't exist anymore since C23, but it still sounds weird to check for errors from a function call by comparing to `~(time_t)0`. Also, I'd really like to have 0 casts in a program. Why would you want to warn about comparison time_t==-1? What's the perceived benefit?