From dc2108e579de340cb4c60f3dde67e5ba6e619406 Mon Sep 17 00:00:00 2001 From: Brian Huffman Date: Fri, 19 Jun 2020 09:19:21 -0700 Subject: [PATCH] Add regression test for issue #642. --- intTests/test_issue642/Makefile | 2 ++ intTests/test_issue642/test.bc | Bin 0 -> 2720 bytes intTests/test_issue642/test.c | 11 ++++++++++ intTests/test_issue642/test.saw | 37 ++++++++++++++++++++++++++++++++ intTests/test_issue642/test.sh | 1 + 5 files changed, 51 insertions(+) create mode 100644 intTests/test_issue642/Makefile create mode 100644 intTests/test_issue642/test.bc create mode 100644 intTests/test_issue642/test.c create mode 100644 intTests/test_issue642/test.saw create mode 100644 intTests/test_issue642/test.sh diff --git a/intTests/test_issue642/Makefile b/intTests/test_issue642/Makefile new file mode 100644 index 0000000000..977e89a70a --- /dev/null +++ b/intTests/test_issue642/Makefile @@ -0,0 +1,2 @@ +test.bc : test.c + clang -c -emit-llvm -g -o test.bc test.c diff --git a/intTests/test_issue642/test.bc b/intTests/test_issue642/test.bc new file mode 100644 index 0000000000000000000000000000000000000000..417112c9381b91e313a7a89058502ea859817559 GIT binary patch literal 2720 zcmaJ?eN0=|6~B*Xd|!ewc48H?y!Y}9EOoaA9(Hg{44c7OLOP-uE$LFNDK?3T+4wNF z>kk@j&)ChQ9e+41Ydxu|>?xhn?H|%cQMN{vF@zz{i)a?L2q6>}icpqCtj)A^tJa-s zV2!kC*E;WRkZ0(GVEyq88Rbe=! z?9?OlHrU+t!jq4_fI<1tHY07PbCO;TCvns$52bNvR<w*vUovouF+ShQFQnOd z1Ghk>arBbxN6K)7coJpgkWscsa=0Cb)3QG)TZ}l=E{D8yID*4o8g_jmmV9#98xQ($ zAoaif&v8qc^4l4Hf#Qk(#XuhOoE)da3=aRlzzh+=(+#H0zvdpbz*qIo=1R1ci_a@mwhF!^& z!(9&{?ahc8W^mLh`{7;mIC2RiK0nE=7&IhuTB49is}8Nv_!*{ z4v!vGfeQfejp4XRn|KT&1%aCxiJe|%dvsLGsKc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qYs z(IxqKT>m+kmjaPN_KBTZ5Qt1@>+UTMOXwuTwhK7K29JmkK@q$^!D8L%?lX0#JpeVo y2hzI%y@=J)W!bmaO`y5A-+gK@5P^*bbDg+>_%1kHMDpXOyWn^c+2n>V$G-u^SXK7` literal 0 HcmV?d00001 diff --git a/intTests/test_issue642/test.c b/intTests/test_issue642/test.c new file mode 100644 index 0000000000..cd8bb7a6a5 --- /dev/null +++ b/intTests/test_issue642/test.c @@ -0,0 +1,11 @@ +#include + +int glob; + +int foo (int *x) { + return (x == &glob); +} + +int bar () { + return foo(&glob); +} diff --git a/intTests/test_issue642/test.saw b/intTests/test_issue642/test.saw new file mode 100644 index 0000000000..b570d50941 --- /dev/null +++ b/intTests/test_issue642/test.saw @@ -0,0 +1,37 @@ +// This test checks whether we can use an override with a pointer +// argument that aliases a global. It is a regression test for +// saw-script issue #642. +// https://github.com/GaloisInc/saw-script/issues/642 + +bc <- llvm_load_module "test.bc"; + +let i32 = llvm_int 32; + +foo_ov <- + crucible_llvm_verify bc "foo" [] false + do { + crucible_alloc_global "glob"; + x <- crucible_alloc i32; + crucible_execute_func [x]; + crucible_return (crucible_term {{ 0 : [32] }}); + } + z3; + +bar_ov1 <- + crucible_llvm_verify bc "bar" [] false + do { + crucible_alloc_global "glob"; + crucible_execute_func []; + crucible_return (crucible_term {{ 1 : [32] }}); + } + z3; + +fails ( + crucible_llvm_verify bc "bar" [foo_ov] false + do { + crucible_alloc_global "glob"; + crucible_execute_func []; + crucible_return (crucible_term {{ 0 : [32] }}); + } + z3 + ); diff --git a/intTests/test_issue642/test.sh b/intTests/test_issue642/test.sh new file mode 100644 index 0000000000..0b864017cd --- /dev/null +++ b/intTests/test_issue642/test.sh @@ -0,0 +1 @@ +$SAW test.saw