diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2026-02-02 11:12:42 +0000 |
|---|---|---|
| committer | gingerBill <gingerBill@users.noreply.github.com> | 2026-02-02 11:12:42 +0000 |
| commit | e014181abf06b1d50458518477b6e3fa8ab08c1a (patch) | |
| tree | 4c8d6ee931d9c17740a42d52f434dc3a66a16d94 /src | |
| parent | f45ca2d03e46886d52641b6f40763e0c95ebc3c8 (diff) | |
Move `values` construction to after padding has been set
Diffstat (limited to 'src')
| -rw-r--r-- | src/llvm_backend_const.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/llvm_backend_const.cpp b/src/llvm_backend_const.cpp index 8ce2137ab..57c07f5c9 100644 --- a/src/llvm_backend_const.cpp +++ b/src/llvm_backend_const.cpp @@ -736,13 +736,14 @@ gb_internal lbValue lb_const_value(lbModule *m, Type *type, ExactValue value, lb } LLVMValueRef tag = LLVMConstInt(LLVMStructGetTypeAtIndex(llvm_type, 1), tag_value, false); LLVMValueRef padding = nullptr; - LLVMValueRef values[3] = {cv.value, tag, padding}; isize value_count = 2; if (LLVMCountStructElementTypes(llvm_type) > 2) { value_count = 3; padding = LLVMConstNull(LLVMStructGetTypeAtIndex(llvm_type, 2)); } + + LLVMValueRef values[3] = {cv.value, tag, padding}; res.value = llvm_const_named_struct_internal(m, llvm_type, values, value_count); res.type = original_type; return res; |