According to a FIXME in RegionStore.cpp the addressing below is referred to as
funny addressing.
int x = ...; int *p = &x; char *q = (char*) p; char c = *q; // returns the first byte of 'x'.
This addressing is a source of false positives at the moment. Look at the following
snippet:
struct S { uint8_t x = 0; uint8_t arr[7]; }; int main() { S P[1]; memset(P->arr, 0, sizeof(P->arr)); const uint8_t *p = (const uint8_t *)(P); auto v = p[2]; <-- uninitialized assign reported! return 0; }
In this example p[2] points to the same place as P[0].arr[1], so it's value is 0,
however the analyzer cannot read that properly and reads it as Undefined instead.
This patch attempts do detect some cases of overlapping memory access, and fall back
to Unknown values in such cases even if we lose information, to reduce the amount of
false positives.
I also wonder if we want to create a checker to handle this instead.
This is also a false positive, look at https://godbolt.org/z/Go778dhza.