r334067 - [Analyzer][Z3] Test fixes for Z3 constraint manager

Vlad Tsyrklevich via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 5 23:25:51 PDT 2018


Author: vlad.tsyrklevich
Date: Tue Jun  5 23:25:51 2018
New Revision: 334067

URL: http://llvm.org/viewvc/llvm-project?rev=334067&view=rev
Log:
[Analyzer][Z3] Test fixes for Z3 constraint manager

Summary:
Since Z3 tests have been not been running [1] some tests needed to be
updated. I also added a regression test for [1].

[1] https://reviews.llvm.org/D47722

Reviewers: george.karpenkov, NoQ, ddcc

Reviewed By: george.karpenkov

Subscribers: mikhail.ramalho, dcoughlin, xazax.hun, szepet, zzheng, a.sidorin, cfe-commits

Differential Revision: https://reviews.llvm.org/D47726

Added:
    cfe/trunk/test/Analysis/z3/enabled.c
Modified:
    cfe/trunk/test/Analysis/PR24184.cpp
    cfe/trunk/test/Analysis/constant-folding.c
    cfe/trunk/test/Analysis/loop-unrolling.cpp

Modified: cfe/trunk/test/Analysis/PR24184.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/PR24184.cpp?rev=334067&r1=334066&r2=334067&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/PR24184.cpp (original)
+++ cfe/trunk/test/Analysis/PR24184.cpp Tue Jun  5 23:25:51 2018
@@ -1,3 +1,4 @@
+// UNSUPPORTED: z3
 // RUN: %clang_analyze_cc1 -w -analyzer-eagerly-assume -fcxx-exceptions -analyzer-checker=core -analyzer-checker=alpha.core.PointerArithm,alpha.core.CastToStruct -analyzer-max-loop 64 -verify %s
 // RUN: %clang_analyze_cc1 -w -analyzer-checker=core -analyzer-checker=cplusplus -fcxx-exceptions -analyzer-checker alpha.core.PointerArithm,alpha.core.CastToStruct -analyzer-max-loop 63 -verify %s
 

Modified: cfe/trunk/test/Analysis/constant-folding.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/constant-folding.c?rev=334067&r1=334066&r2=334067&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/constant-folding.c (original)
+++ cfe/trunk/test/Analysis/constant-folding.c Tue Jun  5 23:25:51 2018
@@ -108,7 +108,11 @@ void testBitwiseRules(unsigned int a, in
   clang_analyzer_eval((b | -2) == 0); // expected-warning{{FALSE}}
   clang_analyzer_eval((b | 10) == 0); // expected-warning{{FALSE}}
   clang_analyzer_eval((b | 0) == 0); // expected-warning{{UNKNOWN}}
+#ifdef ANALYZER_CM_Z3
+  clang_analyzer_eval((b | -2) >= 0); // expected-warning{{FALSE}}
+#else
   clang_analyzer_eval((b | -2) >= 0); // expected-warning{{UNKNOWN}}
+#endif
 
   // Check that dynamically computed constants also work.
   int constant = 1 << 3;

Modified: cfe/trunk/test/Analysis/loop-unrolling.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/loop-unrolling.cpp?rev=334067&r1=334066&r2=334067&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/loop-unrolling.cpp (original)
+++ cfe/trunk/test/Analysis/loop-unrolling.cpp Tue Jun  5 23:25:51 2018
@@ -368,7 +368,11 @@ int nested_inlined_unroll1() {
 int nested_inlined_no_unroll1() {
   int k;
   for (int i = 0; i < 9; i++) {
+#ifdef ANALYZER_CM_Z3
+    clang_analyzer_numTimesReached(); // expected-warning {{13}}
+#else
     clang_analyzer_numTimesReached(); // expected-warning {{15}}
+#endif
     k = simple_unknown_bound_loop();  // reevaluation without inlining, splits the state as well
   }
   int a = 22 / k; // no-warning

Added: cfe/trunk/test/Analysis/z3/enabled.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/z3/enabled.c?rev=334067&view=auto
==============================================================================
--- cfe/trunk/test/Analysis/z3/enabled.c (added)
+++ cfe/trunk/test/Analysis/z3/enabled.c Tue Jun  5 23:25:51 2018
@@ -0,0 +1,3 @@
+// REQUIRES: z3
+// RUN: echo %clang_analyze_cc1 | FileCheck %s
+// CHECK: -analyzer-constraints=z3




More information about the cfe-commits mailing list