about summary refs log tree commit diff homepage
path: root/test/Feature
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/Feature
parent3d0033f099c907bcd5d4d2c2a7562037071ec2bf (diff)
downloadklee-99c522b14dbbf6b26be35b6e7bb8da7b29070287.tar.gz
Inline asm external call
Diffstat (limited to 'test/Feature')
-rw-r--r--test/Feature/InlineAsm.c25
1 files changed, 25 insertions, 0 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;
+}