diff options
Diffstat (limited to 'test/Merging/merge_fail.c')
-rw-r--r-- | test/Merging/merge_fail.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/Merging/merge_fail.c b/test/Merging/merge_fail.c new file mode 100644 index 00000000..5cd9f782 --- /dev/null +++ b/test/Merging/merge_fail.c @@ -0,0 +1,36 @@ +// RUN: %llvmgcc -emit-llvm -g -c -o %t.bc %s +// RUN: rm -rf %t.klee-out +// RUN: klee --output-dir=%t.klee-out --use-merge --debug-log-merge --search=bfs %t.bc 2>&1 | FileCheck %s +// RUN: rm -rf %t.klee-out +// RUN: klee --output-dir=%t.klee-out --use-merge --debug-log-merge --search=dfs %t.bc 2>&1 | FileCheck %s +// RUN: rm -rf %t.klee-out +// RUN: klee --output-dir=%t.klee-out --use-merge --debug-log-merge --search=nurs:covnew %t.bc 2>&1 | FileCheck %s + +// CHECK: open merge: +// CHECK: generated tests = 2{{$}} + +// This test will not merge because we cannot merge states when they allocated memory. + +#include <klee/klee.h> + +int main(int argc, char **args) { + + int* arr = 0; + int a = 0; + + klee_make_symbolic(&a, sizeof(a), "a"); + + klee_open_merge(); + if (a == 0) { + arr = (int*) malloc(7 * sizeof(int)); + arr[0] = 7; + } else { + arr = (int*) malloc(8 * sizeof(int)); + arr[0] = 8; + } + klee_close_merge(); + a = arr[0]; + free(arr); + + return a; +} |