about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorCristian Cadar <c.cadar@imperial.ac.uk>2014-02-24 16:02:18 +0000
committerCristian Cadar <c.cadar@imperial.ac.uk>2014-02-24 16:02:18 +0000
commitb96fd2ce9e2148e076bb755b6a2fc39979a37f6b (patch)
tree9a559b178a643b7b873d247ed47f22610c438404
parent66c064d482160e6c31ccf8ecb0aa93a7529d3da1 (diff)
downloadklee-b96fd2ce9e2148e076bb755b6a2fc39979a37f6b.tar.gz
Fixed AliasFunction.c and AliasFunctionExit.c to work also when optimizations are enabled.
-rw-r--r--test/Feature/AliasFunction.c11
-rw-r--r--test/Feature/AliasFunctionExit.c2
2 files changed, 8 insertions, 5 deletions
diff --git a/test/Feature/AliasFunction.c b/test/Feature/AliasFunction.c
index 16d89ef6..176b152e 100644
--- a/test/Feature/AliasFunction.c
+++ b/test/Feature/AliasFunction.c
@@ -1,25 +1,28 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
 // RUN: %klee %t1.bc > %t1.log
 // RUN: grep -c foo %t1.log | grep 5
-// RUN: grep -c bar %t1.log | grep 3
+// RUN: grep -c bar %t1.log | grep 4
 
 #include <stdio.h>
 #include <stdlib.h>
 
-void foo() { printf("  foo()\n"); }
-void bar() { printf("  bar()\n"); }
+void __attribute__ ((noinline)) foo() { printf("  foo()\n"); }
+void __attribute__ ((noinline)) bar() { printf("  bar()\n"); }
 
 int main() {
   int x;
   klee_make_symbolic(&x, sizeof(x), "x");
 
+  // call once, so that it is not removed by optimizations
+  bar();
+
   // no aliases
   foo();
 
   if (x > 10)
   {
     // foo -> bar
-    klee_alias_function("foo", "bar");    
+    klee_alias_function("foo", "bar");
 
     if (x > 20)
       foo();
diff --git a/test/Feature/AliasFunctionExit.c b/test/Feature/AliasFunctionExit.c
index 4bda950a..acfa4350 100644
--- a/test/Feature/AliasFunctionExit.c
+++ b/test/Feature/AliasFunctionExit.c
@@ -13,7 +13,7 @@ void start(int x) {
     exit(1);
 }
 
-void end(int status) {
+void __attribute__ ((noinline)) end(int status) {
   klee_alias_function("exit", "exit");
   printf("END: status = %d\n", status);
   exit(status);