File tree 6 files changed +58
-2
lines changed
intTests/test_llvm_global_fresh_pointer
src/SAWScript/Crucible/LLVM
6 files changed +58
-2
lines changed Original file line number Diff line number Diff line change
1
+ CLANG ?= clang
2
+ CFLAGS = -g -frecord-command-line
3
+
4
+ all : test.bc
5
+
6
+ test.bc : test.c
7
+ $(CLANG ) -c -emit-llvm $(CFLAGS ) $< -o $@
8
+
9
+ clean :
10
+ rm -f test.bc
11
+
Original file line number Diff line number Diff line change
1
+ int glb ;
2
+
3
+ void foo (const int * x ) {}
4
+
5
+ void bar (const int * x ) {
6
+ foo (x );
7
+ }
8
+
Original file line number Diff line number Diff line change
1
+ enable_experimental;
2
+
3
+ m <- llvm_load_module "test.bc";
4
+
5
+ // test the fact that glb and x_ptr are allowed to alias each other.
6
+ let foo_spec = do {
7
+ llvm_alloc_global "glb";
8
+ x_ptr <- llvm_fresh_pointer (llvm_int 32);
9
+
10
+ llvm_execute_func [x_ptr];
11
+ };
12
+
13
+ foo_ov <- llvm_verify m "foo"
14
+ []
15
+ false
16
+ foo_spec
17
+ (do {
18
+ print_goal;
19
+ w4_unint_z3 [];
20
+ });
21
+
22
+ llvm_verify m "bar"
23
+ [foo_ov]
24
+ false
25
+ foo_spec
26
+ (do {
27
+ print_goal;
28
+ w4_unint_z3 [];
29
+ });
30
+
Original file line number Diff line number Diff line change
1
+ set -e
2
+
3
+ $SAW test.saw
4
+
Original file line number Diff line number Diff line change @@ -1044,8 +1044,11 @@ enforceDisjointAllocGlobal ::
1044
1044
(LLVMAllocGlobal arch , LLVMPtr (Crucible. ArchWidth arch )) ->
1045
1045
OverrideMatcher (LLVM arch ) md ()
1046
1046
enforceDisjointAllocGlobal sym loc
1047
- (LLVMAllocSpec _pmut _pty _palign psz pMd _pfresh _p_sym_init, p)
1048
- (LLVMAllocGlobal qloc (L. Symbol qname), q) =
1047
+ (LLVMAllocSpec _pmut _pty _palign psz pMd pfresh _p_sym_init, p)
1048
+ (LLVMAllocGlobal qloc (L. Symbol qname), q)
1049
+ | pfresh =
1050
+ pure () -- Fresh pointers need not be disjoint
1051
+ | otherwise =
1049
1052
do let Crucible. LLVMPointer pblk _ = p
1050
1053
let Crucible. LLVMPointer qblk _ = q
1051
1054
c <- liftIO $ W4. notPred sym =<< W4. natEq sym pblk qblk
You can’t perform that action at this time.
0 commit comments