On Tue, 16 Feb 2016, Marek Polacek wrote: > Well, it's just that "s" has the nonnull attribute so the compiler thinks it > should never be null in which case comparing it to null should be redundant. > Doesn't seem like a false positive to me, but maybe someone else feels > otherwise.
Please look at the posted code again: static void f(const char *s) { do { printf("%s\n",s); s = NULL; } while (s != NULL); } Since 's' is assigned to, the constraint from 'printf' is no longer useful for warning at the point of comparison. It clearly looks like a false positive to me. Alexander