diff options
| author | gingerBill <bill@gingerbill.org> | 2018-01-19 17:11:28 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2018-01-19 17:11:28 +0000 |
| commit | 2fe660a1d7d9ca32eb4a4056b70fccdceb401d49 (patch) | |
| tree | a122ea824ccec7a68af3e3182e3c5b348a51892b /src/ir.cpp | |
| parent | b03ce0e9b4b43f3d46fec8bb9cf4de56e6ee886a (diff) | |
Fix empty union IR bug
Diffstat (limited to 'src/ir.cpp')
| -rw-r--r-- | src/ir.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index 39d7e3e84..e66349de5 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -8076,8 +8076,11 @@ void ir_setup_type_info_data(irProcedure *proc) { // NOTE(bill): Setup type_info i64 tag_size = union_tag_size(a, t); i64 tag_offset = align_formula(t->Union.variant_block_size, tag_size); - ir_emit_store(proc, tag_offset_ptr, ir_const_uintptr(a, tag_offset)); - ir_emit_store(proc, tag_type_ptr, ir_type_info(proc, union_tag_type(a, t))); + + if (tag_size > 0) { + ir_emit_store(proc, tag_offset_ptr, ir_const_uintptr(a, tag_offset)); + ir_emit_store(proc, tag_type_ptr, ir_type_info(proc, union_tag_type(a, t))); + } } break; |