Try :<br><br>INITIALIZE a1 if you didnt.<br><br>if (cpProf EXISTS){<br>CallInst* newInst = CallInst::Create(cpProf,a1,"");<br><br>if (BB->getTerminator() && CI)<br>     BB->getInstList().insert((Instruction*)CI, newInst);<br>
<br><br><br><br><br><div class="gmail_quote">On Tue, Mar 5, 2013 at 1:04 PM, Anshul Garg <span dir="ltr"><<a href="mailto:gargaa24@gmail.com" target="_blank">gargaa24@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div>CallInst* newInst = CallInst::Create(cpProf,a1,"");</div><div> BB->getInstList().insert((Instruction*)CI, newInst);</div><div><br></div><div>these two lines when i comment there is no segmentation fault.</div>

</div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Mar 5, 2013 at 4:02 AM, Alexandru Ionut Diaconescu <span dir="ltr"><<a href="mailto:alexandruionutdiaconescu@gmail.com" target="_blank">alexandruionutdiaconescu@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Now i saw that you indeed have the declaration before. So check the pointers. what line if you comment gives you no segfault?<div>

<br><br><div class="gmail_quote">On Tue, Mar 5, 2013 at 1:01 PM, Alexandru Ionut Diaconescu <span dir="ltr"><<a href="mailto:alexandruionutdiaconescu@gmail.com" target="_blank">alexandruionutdiaconescu@gmail.com</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">1. check if CI->getNumOperands() is not zero before using it.<br>2. CallInst* newInst = CallInst::Create(cpProf,a1,"")   and then you declare std::vector<Value*> a1(1);....put declaration before<br>


<br>
</blockquote></div><br><br clear="all"><br></div><div><div>-- <br><font style="color:rgb(153,153,153)">Best regards,</font><br style="color:rgb(153,153,153)"><font style="color:rgb(153,153,153)">Alexandru Ionut Diaconescu</font><br>



</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><font style="background-color:rgb(255,255,255);color:rgb(153,153,153)">Best regards,</font><br style="background-color:rgb(255,255,255);color:rgb(153,153,153)">
<font style="background-color:rgb(255,255,255);color:rgb(153,153,153)">Alexandru Ionut Diaconescu</font><br>