Hello everyone,<br><br>I have a segmentation fault while running an LLVM pass. I need to use BBterminators array outside the iterating "for" loop for basic blocks. It seems that LLVM does not protect the addresses ( note: TerminatorInst *BasicBlock::getTerminator() ) when iterating through the loop, so I need to keep in BBterminators "Instruction" type elements, not "Instruction* ". How can I copy entire Instructions into BBterminators?<br>
<br><br>    for (Function::iterator II = F.begin(), EE = F.end(); II != EE; ++II, ++ii)<br>{   <br>     ....... // not relevant code  ;   <br>     <br>    BasicBlock* BB=(dyn_cast<BasicBlock>(II));<br><br>    if (BB->getTerminator())<br>
    {<br>        Instruction* current = BB->getTerminator();<br><br>        Instruction* previous = current->getPrevNode();<br>       <br>        if (current->getOpcode()==Instruction::Br) <br>        {<br>   <br>
            BBterminators[ii]=current;<br>...// not relevant code<br> <br>where Instruction** BBterminators = new Instruction*[100];<br><br>Thank you a lot !<br>Alex<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><br>