[llvm-dev] Getting a pointer to a i8 from a global variable that holds a constant string (original) (raw)
Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Sat Apr 8 17:32:06 PDT 2017
- Previous message: [llvm-dev] Getting a pointer to a i8 from a global variable that holds a constant string
- Next message: [llvm-dev] Getting a pointer to a i8 from a global variable that holds a constant string
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi Lorin,
On 8 April 2017 at 05:18, Lorin Atzberger via llvm-dev <llvm-dev at lists.llvm.org> wrote:
return llvm::ConstantExpr::getGetElementPtr(nullptr,c, constptr14indices);
You need to be using the GlobalVariable as the base of the GEP, not the ConstantDataArray. Then since it's been initialized to the string you want, your GEP will pick up the first element of that string. The ConstantDataArray isn't a pointer (it's an [N x i8], notionally in registers).
Cheers.
Tim.
- Previous message: [llvm-dev] Getting a pointer to a i8 from a global variable that holds a constant string
- Next message: [llvm-dev] Getting a pointer to a i8 from a global variable that holds a constant string
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]