https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119011

--- Comment #3 from Alejandro Colomar <alx at kernel dot org> ---
(In reply to Richard Biener from comment #2)
> Your point that unsigned long == -1 vs. unsigned long == -1u is not the same
> is a very good point to continue diagnosing this.

But the bug is actually in ==-1u.  So we're diagnosing good code, and not
diagnosing bogus code.  I one wanted UINT_MAX, one would use UINT_MAX.  What we
want is to be able to express -1 converted (not casted) to whatever time_t is.

unsigned long == -1 does The Right Thing(tm).  The -1 is first sign-extended,
and afterwards converted, which is what programmers want.

I don't know if anyone would want to keep that diagnostic, but I can conceive
it could happen, which is why I initially proposed the separation of levels =1
and =2, so that people could continue with the current diagnostics by using =2,
and I could drop that diagnostic using =1.

Reply via email to