Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the (modernized) test case from #220 #2196

Merged
merged 1 commit into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions intTests/test0220/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# The current checked-in test.bc was generated by:
# Apple clang version 15.0.0 (clang-1500.1.0.2.5)
# Target: arm64-apple-darwin22.6.0
# Thread model: posix
# InstalledDir: /Library/Developer/CommandLineTools/usr/bin
# but neither the target nor the clang/llvm version is expected to be
# significant.
CC = clang
CFLAGS = -g -O0

all: test.bc

test.bc: test.c
$(CC) $(CFLAGS) -c -emit-llvm $< -o $@

.PHONY: clean
clean:
rm -f test.bc
Binary file added intTests/test0220/test.bc
Binary file not shown.
5 changes: 5 additions & 0 deletions intTests/test0220/test.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
unsigned char y;

void f(void) {
y = 6;
}
15 changes: 15 additions & 0 deletions intTests/test0220/test.saw
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Test an inexact postcondition.

mod <- llvm_load_module "test.bc";

let spec = do {
llvm_alloc_global "y";
y <- llvm_fresh_var "y" (llvm_int 8);
llvm_points_to (llvm_global "y") (llvm_term y);
llvm_execute_func [];
y_new <- llvm_fresh_var "y_new" (llvm_int 8);
llvm_points_to (llvm_global "y") (llvm_term y_new);
llvm_postcond {{ y_new > 0 }};
};

llvm_verify mod "f" [] false spec abc;
3 changes: 3 additions & 0 deletions intTests/test0220/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
set -e

$SAW test.saw
Loading