[PATCH] D45698: [analyzer] When we fail to evaluate a pointer cast, escape the pointer.

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 16 13:52:43 PDT 2018


NoQ created this revision.
NoQ added reviewers: dcoughlin, xazax.hun, a.sidorin, george.karpenkov, szepet.
Herald added subscribers: cfe-commits, rnkovacs.

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.


Repository:
  rC Clang

https://reviews.llvm.org/D45698

Files:
  include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
  lib/StaticAnalyzer/Core/ExprEngine.cpp
  lib/StaticAnalyzer/Core/ExprEngineC.cpp
  test/Analysis/malloc.mm
  test/Analysis/pr22954.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45698.142690.patch
Type: text/x-patch
Size: 6217 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180416/4b0c7317/attachment.bin>


More information about the cfe-commits mailing list