aboutsummaryrefslogtreecommitdiff
path: root/src/llvm_backend.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2023-06-26 17:36:27 +0100
committergingerBill <bill@gingerbill.org>2023-06-26 17:36:27 +0100
commit8b8310711e4924678e605278fca1f8dbf517b903 (patch)
tree7e242ed95488b534f99c61d8d8084b60e29347cc /src/llvm_backend.cpp
parentcdcb64b0d08be85c3ea579270eeb4d193b4cb495 (diff)
Fix #2594 zero sized union code generation
Diffstat (limited to 'src/llvm_backend.cpp')
-rw-r--r--src/llvm_backend.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/llvm_backend.cpp b/src/llvm_backend.cpp
index 730610ad9..12abe7b16 100644
--- a/src/llvm_backend.cpp
+++ b/src/llvm_backend.cpp
@@ -218,7 +218,9 @@ gb_internal lbValue lb_equal_proc_for_type(lbModule *m, Type *type) {
LLVMBuildRet(p->builder, LLVMConstInt(lb_type(m, t_bool), 0, false));
} else if (type->kind == Type_Union) {
- if (is_type_union_maybe_pointer(type)) {
+ if (type_size_of(type) == 0) {
+ LLVMBuildRet(p->builder, LLVMConstInt(lb_type(m, t_bool), 1, false));
+ } else if (is_type_union_maybe_pointer(type)) {
Type *v = type->Union.variants[0];
Type *pv = alloc_type_pointer(v);