Fix interp call instruction

Check that dtype of args and phinodes of init block are compatible
This commit is contained in:
Minseong Jang
2022-03-29 11:57:13 +09:00
parent 4def8318f7
commit 5264066a3c

View File

@@ -1477,6 +1477,19 @@ impl<'i> State<'i> {
func_name: callee_name.clone(),
})?;
let block_init = func_def
.blocks
.get(&func_def.bid_init)
.expect("init block must exists");
if !(args.len() == block_init.phinodes.len()
&& izip!(args, &block_init.phinodes).all(|(a, d)| {
a.dtype().set_const(false) == d.deref().clone().set_const(false)
}))
{
panic!("dtype of args and phinodes of init block must be compatible");
}
let args = self.interp_args(func_signature, args)?;
let stack_frame = StackFrame::new(func_def.bid_init, callee_name, func_def);