I have the following code:
int s[4096];
unsigned char o = 0;
int main(void) {
int *n;
return ((char *) (s + o)) == 0 ? *n : 0;
}
When I run the Clang Static Analyzer on that code, it warns me that I'm dereferencing n because (char *) (s + o) is a null pointer, which it's not (I can even print it and get an address that's definitely not zero).
What am I missing?
I'm noticing that removing the (char *) cast makes the warning disappear.

ohas, this still won't be true. And this is the only codepath in the entire program, so neithersnorocan have any other values than the ones in the program. I'm also noticing that removing the(char *)cast makes the warning disappear.ois anunsigned char, so it can only have values between0and255.