[LLVMdev] LLVM segmentation fault / need use Instruction instead of Instruction*

Alexandru Ionut Diaconescu alexandruionutdiaconescu at gmail.com
Thu Dec 20 02:42:50 PST 2012


Hello John,

I was following your procedures and I isolated the problem. The problem are
represented by the basic blocks with only one element.


for (Function::iterator II = F.begin(), EE = F.end(); II != EE; ++II, ++ii)
{
BasicBlock* BB=II;


if (BB->getTerminator())
    {
        Instruction* current = BB->getTerminator();

        Instruction* previous;

        errs()<<"AAA\n";
        if(*current->getPrevNode()*)
        {
            errs()<<"BBB\n";
            previous = current->getPrevNode();
            ok=1;
        }

        if (ok){
           errs()<<"CCC\n";
              ........


It does print AAA, but then I have the segfault. So when I am evaluating
the *current->getPrevNode() *condition, I got the segfault.
Do you know how can I solve this?

Thank you
Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121220/feea7b5a/attachment.html>


More information about the llvm-dev mailing list