From c9bff1e64b9f6f1d4fa10ecba22d6c05190507bb Mon Sep 17 00:00:00 2001 From: Stefano Sanfilippo Date: Sat, 7 Mar 2015 14:11:25 +0100 Subject: [PATCH] Ensure that parameters passed to function call are of the right type. --- BitcodeEmitter.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/BitcodeEmitter.cpp b/BitcodeEmitter.cpp index 7786088..bf8f9c4 100644 --- a/BitcodeEmitter.cpp +++ b/BitcodeEmitter.cpp @@ -399,10 +399,12 @@ bool BitcodeEmitter::emit(FunctionCall const& node) { }); } + auto param = callee->getArgumentList().begin(); std::vector callargs; for (Expression const* arg: node.getArgs()) { GUARDED(arg->emit(this)); - callargs.push_back(d->retval); + callargs.push_back(coerce(d, d->retval, param->getType())); + ++param; } d->retval = d->builder.CreateCall(callee, callargs);