Zero the extra bytes when widening a value in OdinLLVMBuildTransmute

This commit is contained in:
gingerBill committed 2026-10-10 15:27:18 +01:00
1 parent 12227d8484
commit f254e28068
1 file changed
+4
+4
View File
@@ -3885,6 +3885,10 @@ general_end:;
max_align = gb_max(max_align, 16);
LLVMValueRef ptr = llvm_alloca(p, dst_type, max_align);
if (dst_size > src_size) {
// NOTE(bill): the bytes past `src` are padding and must read as zero
LLVMBuildStore(p->builder, LLVMConstNull(dst_type), ptr);
}
LLVMValueRef nptr = LLVMBuildPointerCast(p->builder, ptr, LLVMPointerType(src_type, 0), "");
LLVMBuildStore(p->builder, val, nptr);