about summary refs log tree commit diff homepage
path: root/test/Replay/libkleeruntest/replay_cex_after_assumed_malloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/Replay/libkleeruntest/replay_cex_after_assumed_malloc.c')
-rw-r--r--test/Replay/libkleeruntest/replay_cex_after_assumed_malloc.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/Replay/libkleeruntest/replay_cex_after_assumed_malloc.c b/test/Replay/libkleeruntest/replay_cex_after_assumed_malloc.c
new file mode 100644
index 00000000..09d60e79
--- /dev/null
+++ b/test/Replay/libkleeruntest/replay_cex_after_assumed_malloc.c
@@ -0,0 +1,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;
+}