<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" id="owaParaStyle" style="display: none;">P {margin-top:0;margin-bottom:0;}</style><style type="text/css" id="owaParaStyle" style="">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
</head>
<body dir="ltr" fpstyle="1" aria-label="Message body" tabindex="0">
<div name="divtagdefaultwrapper" id="divtagdefaultwrapper" style="font-family: Calibri,Arial,Helvetica,sans-serif; font-size: 12pt; color: #000000; margin: 0">
<p>It worked. I managed finally to create the StoreInst.</p>
<p>The problem was in AllocaInst from the start. I was passing a wrong type for CreateAlloca function so it was generating a wrong pointer.</p>
<div>
<p><br>
</p>
<div class="BodyFragment"><font size="2"><span style="font-size:10pt;">
<div class="PlainText">Regards,<br>
Marwa Yusuf<br>
Teaching Assistant - Computer Engineering Department<br>
Faculty of Engineering - Benha University<br>
E-JUST MSc Student<br>
Computer Science & Engineering Dept.</div>
</span></font></div>
</div>
<p><br>
</p>
<div dir="ltr" style="color: rgb(40, 40, 40);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> llvmdev-bounces@cs.uiuc.edu <llvmdev-bounces@cs.uiuc.edu> on behalf of marwayusuf@feng.bu.edu.eg <marwayusuf@feng.bu.edu.eg><br>
<b>Sent:</b> Sunday, November 10, 2013 12:51 PM<br>
<b>To:</b> llvmdev@cs.uiuc.edu<br>
<b>Subject:</b> [LLVMdev] about creating the first value of the storeinst</font>
<div> </div>
</div>
<div>
<div name="divtagdefaultwrapper" id="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:#000000; margin:0">
<p>Dear All</p>
<p>I'm trying to create storeInst using </p>
<p>StoreInst *SI = new StoreInst(val, AI, BB);</p>
<p>AI is an alloca instruction previously created, BB is the basicBlock I want to put instructionsi in. Val is the value to store.</p>
<p>I've created val from a genericValue like this:</p>
<p>Value* val = ConstantInt::get(getGlobalContext(), Result.IntVal);</p>
<div>
<p>Result is the genericValue</p>
<p>However I keep getting this error:</p>
<p>void llvm::StoreInst::AssertOK(): Assertion `getOperand(0)->getType() == cast<PointerType>(getOperand(1)->getType())->getElementType() && "Ptr must be a pointer to Val type!"' failed.</p>
<p><br>
</p>
<p>What is wrong about my code?</p>
<p><br>
</p>
<p>Thanks a million in advance.</p>
<p><br>
</p>
<div class="BodyFragment"><font size="2"><span style="font-size:10pt">
<div class="PlainText">Regards,<br>
Marwa Yusuf<br>
Teaching Assistant - Computer Engineering Department<br>
Faculty of Engineering - Benha University<br>
E-JUST MSc Student<br>
Computer Science & Engineering Dept.</div>
</span></font></div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>