Commit a38cc41d
a38cc41d0948Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 1 file · ~1 modified
Description
fix(codegen): multi-write target coerces int<->bigint per slot type
emit_multi_write_target only handled poly<->concrete coercion;
an a, b = expr shape where the LHS slot was promoted to bigint
but the RHS yielded mrb_int (_t1, sp_IntArray_get(...), etc.)
emitted a raw lv_a = _t1; and tripped -Wint-conversion.
Add int->bigint (sp_bigint_new_int) and bigint->int
(sp_bigint_to_int) wraps to both the LocalVariableTargetNode
and InstanceVariableTargetNode arms.
Promote-mode test count: 473 pass / 50 fail / 95 error -> 476 pass / 52 fail / 90 error. Default raise mode unchanged at 618 / 0 / 0.
Co-Authored-By: Claude Opus 4.7 [email protected]
Details
- Commit
- a38cc41d0948
- Parent
- 9f625d55a639
spinel_codegen.rbmodifiedView file
@@ -25581,6 +25581,16 @@
2558125581
if value_type == "poly" && vt != "" && vt != "poly"2558225582
v = unbox_poly_to(vt, value_expr)2558325583
end25584+
# promote-mode-widened slot: wrap an int RHS through25585+
# sp_bigint_new_int (and unbox the reverse direction).25586+
if vt == "bigint" && value_type == "int"25587+
@needs_bigint = 125588+
v = "sp_bigint_new_int(" + value_expr + ")"25589+
end25590+
if vt == "int" && value_type == "bigint"25591+
@needs_bigint = 125592+
v = "sp_bigint_to_int((sp_Bigint *)" + value_expr + ")"25593+
end2558425594
emit(" " + fiber_var_ref(lname) + " = " + v + ";")2558525595
return2558625596
end@@ -25612,6 +25622,14 @@
2561225622
if value_type == "poly" && it != "" && it != "poly"2561325623
v = unbox_poly_to(it, value_expr)2561425624
end25625+
if it == "bigint" && value_type == "int"25626+
@needs_bigint = 125627+
v = "sp_bigint_new_int(" + value_expr + ")"25628+
end25629+
if it == "int" && value_type == "bigint"25630+
@needs_bigint = 125631+
v = "sp_bigint_to_int((sp_Bigint *)" + value_expr + ")"25632+
end2561525633
end2561625634
emit(" " + self_arrow + sanitize_ivar(iname) + " = " + v + ";")2561725635
end