about summary refs log tree commit diff homepage
path: root/test/Replay/libkleeruntest/replay_cex_after_assumed_malloc.c
blob: 09d60e79df4f22dda4cfcae8c754b3b8a2c803eb (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
// RUN: %clang %s -S -emit-llvm -g -c -o %t.ll
// RUN: rm -rf %t.klee-out
// RUN: %klee --output-dir=%t.klee-out %t.ll
// KLEE just must not fail
#include "klee/klee.h"

int main() {
  char i;
  char *p;
  char *q;
  klee_make_symbolic(&i, sizeof(i), "i");
  klee_make_symbolic(&p, sizeof(p), "p");

  if (i) {}

  q = malloc(sizeof (char));
  klee_assume(p == q);
  klee_make_symbolic(p, sizeof (char), "p[0]");

  char condition = (*p);
  if (*p) condition = 1;
  klee_prefer_cex(&i, condition);
  if (i+5) {}
  return 0;
}