[LLVMdev] access array problem

Duncan Sands baldrick at free.fr
Wed May 18 02:20:28 PDT 2011


Hi Guangming Tan,

> I rewrote the code, please help check why it still does not work:

next time please be more explicit about exactly what goes wrong.

> //create a getelementptr instruction: we want get &Counters[OldCounterSize]
> std::vector<Value*>new_idx;
> new_idx.push_back(OldCounterSize); // ERROR?
> Value *nextaddr = GetElementPtrInst::Create(Counters, new_idx.begin(),
> new_idx.end(), "", InsertPos);

You need to push an index of zero before pushing the OldCounterSize index.

Ciao, Duncan.



More information about the llvm-dev mailing list