diff options
Diffstat (limited to 'test/Feature/ubsan_sadd_overflow.c')
-rw-r--r-- | test/Feature/ubsan_sadd_overflow.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/Feature/ubsan_sadd_overflow.c b/test/Feature/ubsan_sadd_overflow.c new file mode 100644 index 00000000..6ab3c3ab --- /dev/null +++ b/test/Feature/ubsan_sadd_overflow.c @@ -0,0 +1,19 @@ +// RUN: %llvmgcc %s -fsanitize=signed-integer-overflow -emit-llvm -g -O0 -c -o %t.bc +// RUN: %klee %t.bc 2> %t.log +// RUN: grep -c "overflow on unsigned addition" %t.log +// RUN: grep -c "ubsan_sadd_overflow.c:16: overflow" %t.log + +#include "klee/klee.h" + +int main() +{ + signed int x; + signed int y; + volatile signed int result; + + klee_make_symbolic(&x, sizeof(x), "signed add 1"); + klee_make_symbolic(&y, sizeof(y), "signed add 2"); + result = x + y; + + return 0; +} |