aboutsummaryrefslogtreecommitdiff
path: root/src/stage1/ir.cpp
diff options
context:
space:
mode:
authorLemonBoy <thatlemon@gmail.com>2020-10-16 09:16:12 +0200
committerVeikka Tuominen <git@vexu.eu>2020-10-16 17:13:38 +0300
commit2a62d4b20be9b99f53367e74434e1971ced78848 (patch)
treedcff5a330112ddd1fe5f7adc806923f8fe65ccde /src/stage1/ir.cpp
parent996a2284dde16b030a63cb9ba42f586c7a1b66cd (diff)
downloadzig-2a62d4b20be9b99f53367e74434e1971ced78848.tar.gz
zig-2a62d4b20be9b99f53367e74434e1971ced78848.zip
stage1: Expand undefined struct/arrays when indexed
Fixes #6693
Diffstat (limited to 'src/stage1/ir.cpp')
-rw-r--r--src/stage1/ir.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/stage1/ir.cpp b/src/stage1/ir.cpp
index 62c52c8a97..dc74fb9c14 100644
--- a/src/stage1/ir.cpp
+++ b/src/stage1/ir.cpp
@@ -22188,6 +22188,8 @@ static IrInstGen *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstSrcElemP
}
return result;
} else if (is_slice(array_type)) {
+ expand_undef_struct(ira->codegen, array_ptr_val);
+
ZigValue *ptr_field = array_ptr_val->data.x_struct.fields[slice_ptr_index];
ir_assert(ptr_field != nullptr, &elem_ptr_instruction->base.base);
if (ptr_field->data.x_ptr.special == ConstPtrSpecialHardCodedAddr) {
@@ -22252,6 +22254,8 @@ static IrInstGen *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstSrcElemP
}
return result;
} else if (array_type->id == ZigTypeIdArray || array_type->id == ZigTypeIdVector) {
+ expand_undef_array(ira->codegen, array_ptr_val);
+
IrInstGen *result;
if (orig_array_ptr_val->data.x_ptr.mut == ConstPtrMutInfer) {
result = ir_build_elem_ptr_gen(ira, elem_ptr_instruction->base.base.scope,