Extend the dereferenceability analysis to exploit our existing implementation for computing a minimal object size. If we can tell we're within a known allocation, we can speculate the load without changing dereferenceability. This does assume that allocations are dereferenceable within their entire extend, but that seems like an entirely reasonable definition. (It also appears to be true of the existing code.)
Details
Details
Diff Detail
Diff Detail
Event Timeline
lib/Analysis/Loads.cpp | ||
---|---|---|
123 | Does this work in the presence of free? That is: char *ptr = malloc(20) free(ptr); for (;;) { if (false) v = ptr[0]; } |
Comment Actions
The test case Sanjoy added shows a fatal flaw in this approach. If free is possible, my reason would have to be context sensitive and that's not worth implementing at this time.
Does this work in the presence of free? That is: