error: expected end of struct constant

error: expected end of struct constant

我正在尝试生成指向结构的指针数组,但出现此错误:

llc: llvm_test.ll:7:64: error: expected end of struct constant

这是完整代码:

@gc.info.type1 = global {i32, i32} {i32 1, i32 2}
@gc.info.types = global [1 x i8* ] { {i32, i32}* @gc.info.type1* }

错误在最后一行。

尝试以下操作:

@gc.info.type1 = global {i32, i32} {i32 1, i32 2}
@gc.info.types = global [1 x {i32, i32}* ] [ {i32, i32}* @gc.info.type1 ]

我的解决方案如何最终使用 bitcast(感谢#llvm IRC 频道):

@gc.info.type2 = global {i32, i32, i32} {i32 1, i32 2, i32 3}
@gc.info.type2_ptr = global i8* bitcast ({i32, i32, i32}* @gc.info.type2 to i8*)
@gc.info.types = global [2 x i8** ] [ i8** @gc.info.type1_ptr, i8** @gc.info.type2_ptr ]