This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] When we fail to evaluate a pointer cast, escape the pointer.
ClosedPublic

Authored by NoQ on Apr 16 2018, 1:52 PM.

Details

Summary

If a pointer cast fails (evaluates to an UnknownVal) and such cast is the last use of the pointer, the pointer is no longer referenced by the program state and a leak is (mis-)diagnosed. Produce pointer escape (but not invalidation) when the cast fails to avoid such false positives.

Diff Detail

Repository
rC Clang

Event Timeline

NoQ created this revision.Apr 16 2018, 1:52 PM
xazax.hun added a comment.EditedApr 16 2018, 2:09 PM

I am in favour of this approach. This is what I suggested back than in https://reviews.llvm.org/D23014 but it was somehow overlooked.

NoQ added a comment.Apr 16 2018, 2:19 PM

Hmm, yeah, indeed, i must have overlooked it, nice one :) I'll see if i can fix the other place as well.

This revision was not accepted when it landed; it landed in state Needs Review.Apr 19 2018, 4:30 PM
This revision was automatically updated to reflect the committed changes.
NoQ added a comment.Apr 19 2018, 4:31 PM

I am in favour of this approach. This is what I suggested back than in https://reviews.llvm.org/D23014 but it was somehow overlooked.

I'll try to follow-up on this.