Skip to content

Commit

Permalink
Add regression test for #640.
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Huffman committed Jun 17, 2020
1 parent 72b3b2c commit cd9e404
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 0 deletions.
2 changes: 2 additions & 0 deletions intTests/test_llvm_return_null/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test.bc : test.c
clang -c -emit-llvm -g -o test.bc test.c
Binary file added intTests/test_llvm_return_null/test.bc
Binary file not shown.
10 changes: 10 additions & 0 deletions intTests/test_llvm_return_null/test.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include <stdint.h>
#include <stdlib.h>

uint64_t *foo () {
return NULL;
}

int bar () {
return (foo() == NULL);
}
26 changes: 26 additions & 0 deletions intTests/test_llvm_return_null/test.saw
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// This test checks whether we can verify a spec that says a function
// returns a fresh pointer, when in actuality the function returns
// NULL. It is a regression test for saw-script issue #640.
// https://github.com/GaloisInc/saw-script/issues/640

bc <- llvm_load_module "test.bc";

let i64 = llvm_int 64;

fails (
crucible_llvm_verify bc "foo" [] false
do {
crucible_execute_func [];
x <- crucible_alloc i64;
crucible_return x;
}
z3
);

bar_ov1 <-
crucible_llvm_verify bc "bar" [] false
do {
crucible_execute_func [];
crucible_return (crucible_term {{ 1 : [32] }});
}
z3;
1 change: 1 addition & 0 deletions intTests/test_llvm_return_null/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$SAW test.saw

0 comments on commit cd9e404

Please sign in to comment.