https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119011
Vincent Lefèvre <vincent-gcc at vinc17 dot net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |vincent-gcc at vinc17 dot net --- Comment #9 from Vincent Lefèvre <vincent-gcc at vinc17 dot net> --- (In reply to Paul Eggert from comment #8) > (In reply to Jakub Jelinek from comment #4) > > just use ~(time_t)0 or similar. > That has a cast, and part of the point of this bug report is to avoid casts > which are too powerful in C. Yes, and in a more general case, if the type of the variable changes, one may forget to update the type of the cast. But instead of the i == -1 comparison, one could do i + 1 == 0. This should avoid the sign-compare warning in this particular case. > -Wsign-compare gives so many false positives in good code that it’s > typically more trouble than it’s worth. Agreed. That's the case in GNU MPFR, and it does not seem to be possible to avoid all false positives without making the code less maintainable, though fixing PR38470 (VRP) might avoid all of them in our case (or we could improve the code in this way).