`mir_fresh_expanded_value` produces value of incorrect type for `repr(transparent)` structs
RyanGlScott opened this issue · comments
Given this Rust code:
#[repr(transparent)]
pub struct S(u8);
pub fn f(_s: &S) {}
I would expect this specification for `` to verify:
enable_experimental;
m <- mir_load_module "test.linked-mir.json";
s_adt <- mir_find_adt m "test::S" [];
let f_spec = do {
s_ref <- mir_alloc (mir_adt s_adt);
s <- mir_fresh_expanded_value "s" (mir_adt s_adt);
mir_points_to s_ref s;
mir_execute_func [s_ref];
};
mir_verify m "test::f" [] false f_spec z3;
Surprisingly, it does not:
$ ./bin/saw test.saw
[17:18:57.230] Loading file "/home/ryanscott/Documents/Hacking/Haskell/saw-script/test.saw"
[17:18:57.233] Stack trace:
"mir_verify" (/home/ryanscott/Documents/Hacking/Haskell/saw-script/test.saw:15:1-15:11)
Referent type incompatible with value in `mir_points_to` statement:
Referent type: test/eeb62416::S[0]<>
Value type: u8
The use of repr(transparent)
is key here, as the bug does not occur without it.