`saw-core-what4`: `arrayUpdate` panics when sequence literal passed as argument
qsctr opened this issue · comments
Bretton commented
void f() {}
void g() {
f();
}
enable_experimental;
ghost <- llvm_declare_ghost_state "ghost";
let f_spec = do {
arr <- llvm_fresh_cryptol_var "arr" {| Array [16] [1] |};
llvm_ghost_value ghost arr;
llvm_execute_func [];
llvm_ghost_value ghost {{ arrayUpdate arr 10 [True] }};
};
let g_spec = do {
arr <- llvm_fresh_cryptol_var "arr" {| Array [16] [1] |};
llvm_ghost_value ghost arr;
llvm_execute_func [];
llvm_ghost_value ghost {{ arrayUpdate arr 10 0b1 }};
};
m <- llvm_load_module "test.bc";
f_ov <- llvm_unsafe_assume_spec m "f" f_spec;
llvm_verify m "g" [f_ov] false g_spec (w4_unint_z3 []);
results in
[05:38:02.513] You have encountered a bug in SAWCoreWhat4's implementation.
*** Please create an issue at https://github.com/GaloisInc/saw-core-what4/issues
%< ---------------------------------------------------
Revision: UNKNOWN
Branch: UNKNOWN
Location: Verifier.SAW.Simulator.What4.Panic.arrayUpdate
Message: argument type mismatch
CallStack (from HasCallStack):
panic, called at src/Verifier/SAW/Simulator/What4/Panic.hs:14:9 in saw-core-what4-0.2-b015de163453bf1b2a579bb622b3eb875ddd7cd32e540a076c121c0f61e6595d:Verifier.SAW.Simulator.What4.Panic
panic, called at src/Verifier/SAW/Simulator/What4.hs:663:5 in saw-core-what4-0.2-b015de163453bf1b2a579bb622b3eb875ddd7cd32e540a076c121c0f61e6595d:Verifier.SAW.Simulator.What4
%< ---------------------------------------------------
but if you change the [True]
to 0b1
then it works.
After some debugging it seems that Just (Some elm_expr) <- valueToSymExpr elm
is failing due to it returning Nothing
.
saw-script/saw-core-what4/src/Verifier/SAW/Simulator/What4.hs
Lines 646 to 662 in f7b1966
Ryan Scott commented
This is closely related to #1988, although this time, we're likely dealing with a different SAWCore data type.