about summary refs log tree commit diff homepage
path: root/test/Feature
diff options
context:
space:
mode:
authorCristian Cadar <c.cadar@imperial.ac.uk>2017-07-25 13:40:03 +0100
committerDan Liew <delcypher@gmail.com>2017-07-29 12:54:14 +0100
commitfa4d6690d0413b354afe155f9e3f67f7069a6891 (patch)
tree7bfdbeb90c68085be91bebf6b03aa51396afbd0c /test/Feature
parent1af37be2fb7b874620a1f748e715ba4e75029ca0 (diff)
downloadklee-fa4d6690d0413b354afe155f9e3f67f7069a6891.tar.gz
Added an optional KInstruction* argument to evalConstant and evalConstantExpr which allows us to print the location associated with the constant in any error messages. Added a test case for the unsupported features for taking the address of a label, which exercises the patch.
Diffstat (limited to 'test/Feature')
-rw-r--r--test/Feature/AddressOfLabels.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/Feature/AddressOfLabels.c b/test/Feature/AddressOfLabels.c
new file mode 100644
index 00000000..84493fd8
--- /dev/null
+++ b/test/Feature/AddressOfLabels.c
@@ -0,0 +1,36 @@
+// RUN: %llvmgcc -emit-llvm -g -c %s -o %t.bc
+// RUN: rm -rf %t.klee-out
+// RUN: not %klee --output-dir=%t.klee-out %t.bc 2> %t.log
+// RUN: FileCheck --input-file %t.log %s
+
+/* 
+   This currently tests that KLEE clearly reports that it doesn't
+   support taking the address of the labels, in particular
+   blockaddress constants.
+
+   The test would need to be changes once support for this feature is
+   added. 
+*/
+
+#include <stdio.h>
+
+int main (int argc, char** argv)
+{
+  int i = 1;
+  // CHECK: Cannot handle constant 'i8* blockaddress 
+  // CHECK: AddressOfLabels.c:[[@LINE+1]]
+  void * lptr = &&one;
+
+  if (argc > 1)
+    lptr = &&two;
+  
+  goto *lptr;
+
+ one:
+  printf("argc is 1\n");
+  return 0;
+  
+ two:
+  printf("argc is >1\n");
+  return 0;
+}