https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69359
--- Comment #2 from Florian Weimer <fw at gcc dot gnu.org> --- (In reply to Jakub Jelinek from comment #1) > I'd find warning about p <= weird, warning about p < a makes sense, as well > as e.g. > int g (void) > { > int a[3], b; > int *p = f (a, &b); > return (p < a) > + (p < &a[0]) > + (p > &a[3]) > + (p < &b) > + (p > &b + 1); > } > Not a stage4 material though. Agreed. >From my perspective, p <= a is suspicious for the same reason why u <= 0 for an unsigned variable u is suspicious. If the range of the variable is limited and the condition can only be true if there is equality, why not use == instead of <=? <= suggests that the programmer expected something to happen in the code which is impossible, which could point to a logic bug or illegal program, and I think it is fine to warn in such cases.