File: crosscheck-statistics.c

package info (click to toggle)
llvm-toolchain-21 1%3A21.1.6-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,245,028 kB
  • sloc: cpp: 7,619,726; ansic: 1,434,018; asm: 1,058,748; python: 252,740; f90: 94,671; objc: 70,685; lisp: 42,813; pascal: 18,401; sh: 8,601; ml: 5,111; perl: 4,720; makefile: 3,675; awk: 3,523; javascript: 2,409; xml: 892; fortran: 770
file content (31 lines) | stat: -rw-r--r-- 1,011 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// RUN: %clang_analyze_cc1 -analyzer-checker=core -verify %s  \
// RUN:   -analyzer-config crosscheck-with-z3=true \
// RUN:   -analyzer-stats 2>&1 | FileCheck %s

// REQUIRES: z3

int accepting(int n) {
  if (n == 4) {
    n = n / (n-4); // expected-warning {{Division by zero}}
  }
  return n;
}

int rejecting(int n, int x) {
  // Let's make the path infeasible.
  if (2 < x && x < 5 && x*x == x*x*x) {
    // Have the same condition as in 'accepting'.
    if (n == 4) {
      n = x / (n-4); // no-warning: refuted
    }
  }
  return n;
}

// CHECK:       1 BugReporter         - Number of times all reports of an equivalence class was refuted
// CHECK-NEXT:  1 BugReporter         - Number of reports passed Z3
// CHECK-NEXT:  1 BugReporter         - Number of reports refuted by Z3

// CHECK:       1 Z3CrosscheckOracle - Number of Z3 queries accepting a report
// CHECK-NEXT:  1 Z3CrosscheckOracle - Number of Z3 queries rejecting a report
// CHECK-NEXT:  2 Z3CrosscheckOracle - Number of Z3 queries done