From 6dda0198f0d96cc95e954006a800eb4e46d3258a Mon Sep 17 00:00:00 2001 From: Mihail Moskov <28909106+corleypc@users.noreply.github.com> Date: Wed, 12 Aug 2026 16:02:49 +0300 Subject: [PATCH] fixes f32 to 64-bit int/uint conversion --- src/llvm_backend_expr.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/llvm_backend_expr.cpp b/src/llvm_backend_expr.cpp index 2ef7f9b29..63c45711f 100644 --- a/src/llvm_backend_expr.cpp +++ b/src/llvm_backend_expr.cpp @@ -2546,7 +2546,9 @@ gb_internal lbValue lb_emit_conv(lbProcedure *p, lbValue value, Type *t) { lbValue res_i128 = lb_emit_runtime_call(p, call, args); return lb_emit_conv(p, res_i128, t); } - i64 sz = type_size_of(src); + // the intermediate int must be at least as wide as the dest, + // otherwise e.g. f32 -> u64 truncates through a 32-bit fptoui + i64 sz = gb_max(type_size_of(src), type_size_of(dst)); lbValue res = {}; res.type = t;