[PATCH] D25326: [StaticAnalyser] Don't merge different returns in ExplodedGraph

Devin Coughlin via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 10 08:23:08 PDT 2016


dcoughlin added inline comments.


================
Comment at: test/Analysis/unreachable-code-path.c:201
+static int inlineFunction(const int i) {
+  if (table[i] != 0)
+    return 1;
----------------
danielmarjamaki wrote:
> NoQ wrote:
> > a.sidorin wrote:
> > > I have a small question. Is it possible to simplify this sample with removing of table[] array? Like putting something like `i != 0` into condition. As I understand, the problem is not array-related.
> > Any `UnknownVal` in the condition would trigger this issue.
> > Is it possible to simplify this sample with removing of table[] array? 
> 
> I tried to simplify as much as possible. But as NoQ says an UnknownVal is required here for this test.
This is worth a comment in the test then, so that if we ever add symbolic reasoning we'll know how to adjust the test.

You could also try to add a canary with clang analyzer eval after the if statement to force the test to fail if we do add this symbolic reasoning.


Repository:
  rL LLVM

https://reviews.llvm.org/D25326





More information about the cfe-commits mailing list