File tree 5 files changed +51
-0
lines changed
intTests/test_llvm_alignment
5 files changed +51
-0
lines changed Original file line number Diff line number Diff line change
1
+ test.bc : test.c
2
+ clang -c -emit-llvm -g -o test.bc test.c
Original file line number Diff line number Diff line change
1
+ #include <stdint.h>
2
+
3
+ void write (uint64_t * p , uint64_t x ) {
4
+ * p = x ;
5
+ }
6
+
7
+ void write_unaligned (uint8_t * p , uint64_t x ) {
8
+ write ((uint64_t * )(p + 1 ), x );
9
+ }
Original file line number Diff line number Diff line change
1
+ // This is a regression test for saw-script issue #635.
2
+ // https://github.com/GaloisInc/saw-script/issues/635
3
+
4
+ bc <- llvm_load_module "test.bc";
5
+
6
+ let i8 = llvm_int 8;
7
+ let i64 = llvm_int 64;
8
+
9
+ write_ov <-
10
+ crucible_llvm_verify bc "write" [] false
11
+ do {
12
+ p <- crucible_alloc i64;
13
+ x <- crucible_fresh_var "x" i64;
14
+ crucible_execute_func [p, crucible_term x];
15
+ crucible_points_to p (crucible_term x);
16
+ }
17
+ z3;
18
+
19
+ let write_unaligned_spec =
20
+ do {
21
+ p <- crucible_alloc (llvm_array 16 i8);
22
+ b <- crucible_fresh_var "b" (llvm_array 16 i8);
23
+ x <- crucible_fresh_var "x" i64;
24
+ crucible_points_to p (crucible_term b);
25
+ crucible_execute_func [p, crucible_term x];
26
+ crucible_points_to p (crucible_term {{ take`{1} b # reverse (split x) # drop`{9} b }});
27
+ };
28
+
29
+ fails (
30
+ crucible_llvm_verify bc "write_unaligned" [] false
31
+ write_unaligned_spec
32
+ z3
33
+ );
34
+
35
+ fails (
36
+ crucible_llvm_verify bc "write_unaligned" [write_ov] false
37
+ write_unaligned_spec
38
+ z3
39
+ );
Original file line number Diff line number Diff line change
1
+ $SAW test.saw
You can’t perform that action at this time.
0 commit comments