[LLVMdev] Segmentation fault while adding an addtional argument (original) (raw)

Shawn Kim shawn.subscribe at gmail.com
Tue Sep 20 17:05:09 PDT 2011


Hi, all

I am trying to write a function pass to replace a old function to a new function like: int haha(int a) { } ==> int haha(int a, char *IO) { }

The below is a part of my code and generate segmentation fault. Can you help me to fix it? Thanks, Shawn

// Since we have now created the new function, splice the body of the

old // function right into the new function, leaving the old rotting hulk of the // function empty. NF->getBasicBlockList().splice(NF->begin(), F.getBasicBlockList());

Value *Globals = NF->arg_end();
Globals->setName("globals");

========================================================== 150 Globals->setName("globals"); (gdb)

Program received signal SIGSEGV, Segmentation fault. 0x08591311 in llvm::StringRef::operator[] (this=0xbfffeca0, Index=0) at /home/skim/Etc/LLVM/llvm/include/llvm/ADT/StringRef.h:181 181 return Data[Index]; -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110920/7e035f28/attachment.html>



More information about the llvm-dev mailing list