Gilgamesz
Gilgamesz

Reputation: 5073

expected comma after getelementptr's type. LLVM

(1) @str = private constant [13 x i8] c"Hello World\0A\00"
(2) define i32 @main(){
(3) %r2 = getelementptr [13 x i8]* @str, i32 0, i32 0
(4) ret i32 0
(5) }

I've got an error error in the line 3: expected comma after getelementptr's type. How to deal with it?

Upvotes: 3

Views: 1892

Answers (1)

Kritzefitz
Kritzefitz

Reputation: 2754

getelemtptr expects the type that you are indexing (without the pointer) as it's first argument. In your case that would be [13 x i8], so you probably want to do something like this:

%r2 = getelementptr [13 x i8], [13 x i8]* @str, i32 0, i32 0

Upvotes: 7

Related Questions