mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Hack: union compound literal fix
This commit is contained in:
+1
-1
@@ -982,7 +982,7 @@ typedef struct gbThread {
|
|||||||
|
|
||||||
gbSemaphore semaphore;
|
gbSemaphore semaphore;
|
||||||
isize stack_size;
|
isize stack_size;
|
||||||
b32 is_running;
|
b32 volatile is_running;
|
||||||
} gbThread;
|
} gbThread;
|
||||||
|
|
||||||
GB_DEF void gb_thread_init (gbThread *t);
|
GB_DEF void gb_thread_init (gbThread *t);
|
||||||
|
|||||||
+12
-4
@@ -4330,7 +4330,6 @@ void ir_emit_store_union_variant(irProcedure *proc, irValue *parent, irValue *va
|
|||||||
gbAllocator a = ir_allocator();
|
gbAllocator a = ir_allocator();
|
||||||
irValue *underlying = ir_emit_conv(proc, parent, alloc_type_pointer(variant_type));
|
irValue *underlying = ir_emit_conv(proc, parent, alloc_type_pointer(variant_type));
|
||||||
|
|
||||||
irValue *v = variant;
|
|
||||||
ir_emit_store(proc, underlying, variant);
|
ir_emit_store(proc, underlying, variant);
|
||||||
|
|
||||||
Type *t = type_deref(ir_type(parent));
|
Type *t = type_deref(ir_type(parent));
|
||||||
@@ -7026,9 +7025,18 @@ irAddr ir_build_addr(irProcedure *proc, Ast *expr) {
|
|||||||
|
|
||||||
GB_ASSERT(ir_type(field_expr)->kind != Type_Tuple);
|
GB_ASSERT(ir_type(field_expr)->kind != Type_Tuple);
|
||||||
|
|
||||||
irValue *fv = ir_emit_conv(proc, field_expr, ft);
|
Type *fet = ir_type(field_expr);
|
||||||
irValue *gep = ir_emit_struct_ep(proc, v, cast(i32)index);
|
// HACK TODO(bill): THIS IS A MASSIVE HACK!!!!
|
||||||
ir_emit_store(proc, gep, fv);
|
if (is_type_union(ft) && !are_types_identical(fet, ft)) {
|
||||||
|
GB_ASSERT(union_variant_index(ft, fet) > 0);
|
||||||
|
|
||||||
|
irValue *gep = ir_emit_struct_ep(proc, v, cast(i32)index);
|
||||||
|
ir_emit_store_union_variant(proc, gep, field_expr, fet);
|
||||||
|
} else {
|
||||||
|
irValue *fv = ir_emit_conv(proc, field_expr, ft);
|
||||||
|
irValue *gep = ir_emit_struct_ep(proc, v, cast(i32)index);
|
||||||
|
ir_emit_store(proc, gep, fv);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user