msan: hoist value checks as much as possible
| Bugzilla Link | 37670 |
| Version | unspecified |
| OS | Linux |
| CC | @eugenis,@ramosian-glider,@kcc,@vitalybuka |
Extended Description
Currently msan places checks as late as possible, e.g. at branch on a bool value. In some cases this makes it very hard to understand where the actual uninit-ness come from.
Consider:
void foo(struct p *p) { if (p->x == p->y && // msan points here p->w == p->z) // however it would be more useful to point here printf("x\n"); }
or:
int main() { volatile int l; x = l; p = malloc(1); void *r = get(); if (r) // with -O2 msan points here printf("x\n"); return 0; }
volatile int x; void* p;
void *get() { int y = x / 16; // but ideally it would point here, so that it's clear that it's x the bad guy if (!y) return 0; return p; }
If we see a computation, or even a load, which sinks into msan check on all paths, we could produce a warning right at that point.