Commit 312589b2
312589b2180bMerged
Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 1 file · ~1 modified
Description
fix(codegen): super(...) call boxes int->bigint at parent param boundary
super(0) against a parent initialize(kind) whose kind slot
promoted to bigint cast the int literal directly to a pointer
((sp_Bigint *)0LL) -- NULL. sp_bigint_cmp then null-derefed.
Use sp_bigint_new_int / sp_bigint_to_int at the boundary like the rest of the int<->bigint coerce paths. Picks up gc_scan_skip_inherited_ivar.
Co-Authored-By: Claude Opus 4.7 [email protected]
Details
- Commit
- 312589b2180b
- Parent
- 47f481b46f5e
spinel_codegen.rbmodifiedView file
@@ -9837,7 +9837,20 @@
98379837
if ak < p_ptypes.length98389838
at_arg = infer_type(arg_ids[ak])98399839
if p_ptypes[ak] != at_arg && p_ptypes[ak] != ""9840-
arg_expr2 = "(" + c_type(p_ptypes[ak]) + ")" + arg_expr29840+
# int -> bigint: box via sp_bigint_new_int. A raw cast would9841+
# produce a NULL pointer for literal 0 / negative ints and9842+
# garbage for nonzero literals (interprets the int as a heap9843+
# address). Same shape on the inverse path: bigint -> int9844+
# unbox via sp_bigint_to_int.9845+
if base_type(p_ptypes[ak]) == "bigint" && base_type(at_arg) == "int"9846+
@needs_bigint = 19847+
arg_expr2 = "sp_bigint_new_int(" + arg_expr2 + ")"9848+
elsif base_type(p_ptypes[ak]) == "int" && base_type(at_arg) == "bigint"9849+
@needs_bigint = 19850+
arg_expr2 = "sp_bigint_to_int((sp_Bigint *)" + arg_expr2 + ")"9851+
else9852+
arg_expr2 = "(" + c_type(p_ptypes[ak]) + ")" + arg_expr29853+
end98419854
end98429855
end98439856
super_args = super_args + arg_expr2