about summary refs log tree commit diff homepage
path: root/runtime/Intrinsic
diff options
context:
space:
mode:
authorCristian Cadar <cristic@cs.stanford.edu>2011-12-11 21:29:52 +0000
committerCristian Cadar <cristic@cs.stanford.edu>2011-12-11 21:29:52 +0000
commit4d12b8c6f4fdbd82585340d4f682f7c8d82f1ae1 (patch)
treec192f8ea0b9df69f2a6e17a2ce54626af772228e /runtime/Intrinsic
parent2e08a4bf1c792d8743c3f61ea7aaaf2cd513829c (diff)
downloadklee-4d12b8c6f4fdbd82585340d4f682f7c8d82f1ae1.tar.gz
This is a workaround for the infinite loop reported at
http://keeda.stanford.edu/pipermail/klee-dev/2011-August/000723.html

KLEE needs to use --fno-builtin when compiling its version of memset.
However, this patch also adds the workaround suggested by Paul in the
thread above, since support for --fno-builtin was added to llvm-gcc only
after LLVM 2.9 was released.

More details about this issue can be found here:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20110411/119376.html
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20110711/124131.html

Thanks to Paul and arrowdodger for their explanations and patches.



git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@146350 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'runtime/Intrinsic')
-rw-r--r--runtime/Intrinsic/Makefile2
-rw-r--r--runtime/Intrinsic/memset.c2
2 files changed, 3 insertions, 1 deletions
diff --git a/runtime/Intrinsic/Makefile b/runtime/Intrinsic/Makefile
index 721b9772..849bfeee 100644
--- a/runtime/Intrinsic/Makefile
+++ b/runtime/Intrinsic/Makefile
@@ -17,4 +17,6 @@ BYTECODE_LIBRARY=1
 DEBUG_RUNTIME=1
 NO_PEDANTIC=1
 
+C.Flags += -fno-builtin
+
 include $(LEVEL)/Makefile.common
diff --git a/runtime/Intrinsic/memset.c b/runtime/Intrinsic/memset.c
index ee9ecb87..bef85e6a 100644
--- a/runtime/Intrinsic/memset.c
+++ b/runtime/Intrinsic/memset.c
@@ -10,7 +10,7 @@
 #include <stdlib.h>
 
 void *memset(void * dst, int s, size_t count) {
-    char * a = dst;
+    volatile char * a = dst;
     while (count-- > 0)
       *a++ = s;
     return dst;