<div dir="ltr">Hello<div><br></div><div>I am trying to insert malloc calls in my function pass, yet it keeps complaining about the parameter type:</div><div><br></div><div><font face="monospace">Call parameter type does not match function signature!<br>i64 4096<br> i8*  %malloccall = tail call i8* @malloc(i64 4096)</font><br></div><div><font face="monospace"><br></font></div><div><font face="arial, sans-serif">Comparing this to a call generated by simply having a malloc in the C code, I cannot spot significant differences. The following (generated by clang) works just fine:</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="monospace">%2 = call noalias i8* @malloc(i64 4096) #2</font><font face="arial, sans-serif"><br></font></div><div><br></div><div>Why does one work but the other doesn't? Below is the code I use to generate the instruction:</div><div><br></div><div>T<font face="monospace">ype *int8Type = Type::getInt8Ty(this->currentFunction->getContext());<br>Type *int64Type = Type::getInt64Ty(this->currentFunction->getContext());<br><br>auto allocSize = ConstantInt::get(int64Type, 4096);<br><br>Instruction* mallocInstr = CallInst::CreateMalloc(this->currentFunction->getEntryBlock().getFirstNonPHI(),<br>                                                  int8Type->getPointerTo(), int8Type, allocSize,<br>                                                  nullptr, nullptr, "");</font><br></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">I tried changing up the types already but didn't find a combination that works yet. Any hints would be appreciated.</font></div><div><font face="monospace"><br></font></div><div><font face="arial, sans-serif">Regards,</font></div><div><font face="arial, sans-serif">Z</font></div></div>