From 5264066a3cb1cf999416340556a30a6855670e53 Mon Sep 17 00:00:00 2001 From: Minseong Jang Date: Tue, 29 Mar 2022 11:57:13 +0900 Subject: [PATCH] Fix interp call instruction Check that dtype of args and phinodes of init block are compatible --- src/ir/interp.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/ir/interp.rs b/src/ir/interp.rs index 03fdbe0..da0860e 100644 --- a/src/ir/interp.rs +++ b/src/ir/interp.rs @@ -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);