about summary refs log tree commit diff homepage
path: root/test/Feature/AliasFunctionExit.c
blob: 4bda950ace64b0367daa6c74d57f699cccb84dd8 (plain) (blame)
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
// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
// RUN: %klee %t1.bc > %t1.log
// RUN: grep -c START %t1.log | grep 1
// RUN: grep -c END %t1.log | grep 2

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

void start(int x) {
  printf("START\n");
  if (x == 53)
    exit(1);
}

void end(int status) {
  klee_alias_function("exit", "exit");
  printf("END: status = %d\n", status);
  exit(status);
}


int main() {
  int x;
  klee_make_symbolic(&x, sizeof(x), "x");

  klee_alias_function("exit", "end");
  start(x);
  end(0);
}