[LLVMdev] Pointer to String Constant
mcheva at cs.mcgill.ca
Thu Mar 4 18:50:41 CST 2010
I'm writing a C compiler in OCaml and I've run into a small problem. I wrote
the following piece of code to generate a pointer to a string constant, so I
could compile C expressions of the form "const char* p = "test\n";" :
let strval = const_stringz codecontext v in
const_gep strval [| i32_zero; i32_zero |]
The dump statements I put confirm that the string array and the index values
have the types I would expect:
[6 x i8] c"test\0A\00"
However, the code still seems to break an assertion:
Constants.cpp:1487: static llvm::Constant*
llvm::ConstantExpr::getGetElementPtr(llvm::Constant*, llvm::Value* const*,
unsigned int): Assertion `Ty && "GEP indices invalid!"' failed.
Could someone tell me what I'm doing wrong here?
View this message in context: http://old.nabble.com/Pointer-to-String-Constant-tp27788693p27788693.html
Sent from the LLVM - Dev mailing list archive at Nabble.com.
More information about the LLVMdev