diff options
| author | Karl Zylinski <karl@zylinski.se> | 2024-09-14 11:26:41 +0200 |
|---|---|---|
| committer | Karl Zylinski <karl@zylinski.se> | 2024-09-14 11:26:41 +0200 |
| commit | 86e291235dd7225e3ce21c916a68efba0bd9232c (patch) | |
| tree | 90f127e1a588f78447521c28e460ccf26d5a632a /src/llvm_backend_const.cpp | |
| parent | f9de8fdaba12746b9c458e916ba6bb9d7c5b7aa7 (diff) | |
| parent | 129d85fe7d05a41732cea3bd15b02a4286276a15 (diff) | |
Merge remote-tracking branch 'origin/master' into file-tags-without-comments
Diffstat (limited to 'src/llvm_backend_const.cpp')
| -rw-r--r-- | src/llvm_backend_const.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/llvm_backend_const.cpp b/src/llvm_backend_const.cpp index 6a6b119aa..754bbfca2 100644 --- a/src/llvm_backend_const.cpp +++ b/src/llvm_backend_const.cpp @@ -154,7 +154,7 @@ gb_internal LLVMValueRef llvm_const_named_struct(lbModule *m, Type *t, LLVMValue GB_ASSERT(value_count_ == bt->Struct.fields.count); auto field_remapping = lb_get_struct_remapping(m, t); - unsigned values_with_padding_count = LLVMCountStructElementTypes(struct_type); + unsigned values_with_padding_count = elem_count; LLVMValueRef *values_with_padding = gb_alloc_array(permanent_allocator(), LLVMValueRef, values_with_padding_count); for (unsigned i = 0; i < value_count; i++) { @@ -722,7 +722,7 @@ gb_internal lbValue lb_const_value(lbModule *m, Type *type, ExactValue value, bo } case ExactValue_Integer: - if (is_type_pointer(type) || is_type_multi_pointer(type)) { + if (is_type_pointer(type) || is_type_multi_pointer(type) || is_type_proc(type)) { LLVMTypeRef t = lb_type(m, original_type); LLVMValueRef i = lb_big_int_to_llvm(m, t_uintptr, &value.value_integer); res.value = LLVMConstIntToPtr(i, t); |