File: crosscheck-statistics.c

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,998,520 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (33 lines) | stat: -rw-r--r-- 1,062 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
32
33
// 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

// expected-error@1 {{Z3 refutation rate:1/2}}

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 Z3CrosscheckVisitor - Number of Z3 queries accepting a report
// CHECK-NEXT:  1 Z3CrosscheckVisitor - Number of Z3 queries rejecting a report
// CHECK-NEXT:  2 Z3CrosscheckVisitor - Number of Z3 queries done