aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-04-02 19:09:25 -0400
committerAndrew Kelley <andrew@ziglang.org>2019-04-02 19:09:25 -0400
commit6a7b75b73c502ecd6f34c497cc86bded02746cb2 (patch)
treec721f43d0c444865b40277b4120ea0f657306d65 /src
parent15bd4aa54fcebc9f8296be6138c7775f23082746 (diff)
downloadzig-6a7b75b73c502ecd6f34c497cc86bded02746cb2.tar.gz
zig-6a7b75b73c502ecd6f34c497cc86bded02746cb2.zip
fix LLVM assertion failures
Diffstat (limited to 'src')
-rw-r--r--src/analyze.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp
index c1640bd19b..0f6f7ac799 100644
--- a/src/analyze.cpp
+++ b/src/analyze.cpp
@@ -6359,6 +6359,7 @@ static void resolve_llvm_types_slice(CodeGen *g, ZigType *type, ResolveStatus wa
LLVMTypeRef element_types[2];
element_types[slice_ptr_index] = get_llvm_type(g, ptr_type);
element_types[slice_len_index] = get_llvm_type(g, g->builtin_types.entry_usize);
+ if (type->data.structure.resolve_status >= wanted_resolve_status) return;
LLVMStructSetBody(type->llvm_type, element_types, 2, false);
uint64_t ptr_debug_size_in_bits = ptr_type->size_in_bits;
@@ -6776,6 +6777,12 @@ static void resolve_llvm_types_union(CodeGen *g, ZigType *union_type, ResolveSta
static void resolve_llvm_types_pointer(CodeGen *g, ZigType *type) {
if (type->llvm_di_type != nullptr) return;
+ if (!type_has_bits(type)) {
+ type->llvm_type = g->builtin_types.entry_void->llvm_type;
+ type->llvm_di_type = g->builtin_types.entry_void->llvm_di_type;
+ return;
+ }
+
ZigType *elem_type = type->data.pointer.child_type;
if (type->data.pointer.is_const || type->data.pointer.is_volatile ||
@@ -6811,6 +6818,12 @@ static void resolve_llvm_types_pointer(CodeGen *g, ZigType *type) {
static void resolve_llvm_types_integer(CodeGen *g, ZigType *type) {
if (type->llvm_di_type != nullptr) return;
+ if (!type_has_bits(type)) {
+ type->llvm_type = g->builtin_types.entry_void->llvm_type;
+ type->llvm_di_type = g->builtin_types.entry_void->llvm_di_type;
+ return;
+ }
+
unsigned dwarf_tag;
if (type->data.integral.is_signed) {
if (type->size_in_bits == 8) {