fix double getelementptr of runtime global

This commit is contained in:
Andrew Kelley
2019-06-19 22:29:39 -04:00
parent 04c25efe11
commit 78eeb6e9ae
3 changed files with 76 additions and 125 deletions

View File

@@ -3832,6 +3832,9 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutable *executable, IrInstr
static LLVMValueRef ir_render_struct_field_ptr(CodeGen *g, IrExecutable *executable,
IrInstructionStructFieldPtr *instruction)
{
if (instruction->base.value.special != ConstValSpecialRuntime)
return nullptr;
LLVMValueRef struct_ptr = ir_llvm_value(g, instruction->struct_ptr);
// not necessarily a pointer. could be ZigTypeIdStruct
ZigType *struct_ptr_type = instruction->struct_ptr->value.type;