Segmentation fault while adding an addtional argument

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”);

You can't dereference arg_end... you might want to read up a bit on
C++ iterators.

-Eli