about summary refs log tree commit diff homepage
path: root/test
diff options
context:
space:
mode:
authorMikhail <mishok2503@mail.ru>2022-06-08 16:36:28 +0300
committerMartinNowack <2443641+MartinNowack@users.noreply.github.com>2022-07-04 22:20:00 +0100
commit99c522b14dbbf6b26be35b6e7bb8da7b29070287 (patch)
tree49fb535d7beda87188b878c053b1b3241e07fc3f /test
parent3d0033f099c907bcd5d4d2c2a7562037071ec2bf (diff)
downloadklee-99c522b14dbbf6b26be35b6e7bb8da7b29070287.tar.gz
Inline asm external call
Diffstat (limited to 'test')
-rw-r--r--test/Feature/InlineAsm.c25
-rw-r--r--test/regression/2012-05-13-asm-causes-aborts.c9
-rw-r--r--test/regression/2022-06-28-asm-causes-error.c9
3 files changed, 34 insertions, 9 deletions
diff --git a/test/Feature/InlineAsm.c b/test/Feature/InlineAsm.c
new file mode 100644
index 00000000..25e0e72e
--- /dev/null
+++ b/test/Feature/InlineAsm.c
@@ -0,0 +1,25 @@
+// RUN: %clang %s -emit-llvm %O0opt -c -g -o %t.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --external-calls=all --exit-on-error --output-dir=%t.klee-out %t.bc > %t.output.log 2>&1
+
+#include <assert.h>
+
+int main() {
+
+  int x;
+  klee_make_symbolic(&x, sizeof(x), "x");
+  if (x == 239) {
+    __asm__("neg %0"
+            : "+r"(x));
+    assert(x == -239);
+  }
+
+  int y = x;
+  __asm__("add $5, %0"
+          : "+r"(x));
+  __asm__("add $0, %0"
+          : "+r"(y));
+  assert(x == y + 5);
+
+  return 0;
+}
diff --git a/test/regression/2012-05-13-asm-causes-aborts.c b/test/regression/2012-05-13-asm-causes-aborts.c
deleted file mode 100644
index 53fd0da9..00000000
--- a/test/regression/2012-05-13-asm-causes-aborts.c
+++ /dev/null
@@ -1,9 +0,0 @@
-// RUN: %clang %s -emit-llvm %O0opt -c -o %t1.bc
-// RUN: rm -rf %t.klee-out
-// RUN: %klee --output-dir=%t.klee-out %t1.bc
-
-int main(int argc, char *argv[]){
-	__asm__ __volatile__ ("movl %eax, %eax");
-	return 0;
-}
-
diff --git a/test/regression/2022-06-28-asm-causes-error.c b/test/regression/2022-06-28-asm-causes-error.c
new file mode 100644
index 00000000..7b60a865
--- /dev/null
+++ b/test/regression/2022-06-28-asm-causes-error.c
@@ -0,0 +1,9 @@
+// RUN: %clang %s -g -emit-llvm %O0opt -c -o %t1.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --external-calls=none --output-dir=%t.klee-out %t1.bc 2>&1 | FileCheck %s
+
+int main(int argc, char *argv[]) {
+  // CHECK: 2022-06-28-asm-causes-error.c:[[@LINE+1]]: external calls disallowed (in particular inline asm)
+  __asm__ __volatile__("movl %eax, %eax");
+  return 0;
+}