about summary refs log tree commit diff homepage
path: root/test/Feature/FunctionAliasExit.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/Feature/FunctionAliasExit.c')
-rw-r--r--test/Feature/FunctionAliasExit.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/Feature/FunctionAliasExit.c b/test/Feature/FunctionAliasExit.c
new file mode 100644
index 00000000..b30838d0
--- /dev/null
+++ b/test/Feature/FunctionAliasExit.c
@@ -0,0 +1,31 @@
+// RUN: %clang %s -emit-llvm %O0opt -c -o %t.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out -function-alias=exit:end %t.bc 2>&1 | FileCheck %s
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+// CHECK: KLEE: function-alias: replaced @exit with @end
+
+void start(int x) {
+  // CHECK: START
+  printf("START\n");
+  if (x == 53)
+    // CHECK: END: status = 1
+    exit(1);
+}
+
+void __attribute__ ((noinline)) end(int status) {
+  printf("END: status = %d\n", status);
+  klee_silent_exit(status);
+}
+
+int main() {
+  int x;
+  klee_make_symbolic(&x, sizeof(x), "x");
+
+  start(x);
+  // CHECK: END: status = 0
+  end(0);
+}