Commit 05775903
057759034cbdMerged
Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 1 file · ~1 modified
Description
fix(codegen): case-match scrutinee unboxes bigint to mrb_int
Both compile_case_match_stmt and compile_case_match_return
declared the case/in predicate temp as mrb_int <tmp> = <pred>
for non-string/poly/float scrutinees. A promote-widened Integer
predicate landed there as sp_Bigint *, tripping
-Wint-conversion.
Mirror the case-stmt / case-expr fixes: explicit bigint arm that unboxes via sp_bigint_to_int and locally rewrites pred_type to "int" so the per-pattern dispatch picks the int compare path.
Promote-mode test count: 508 pass / 47 fail / 63 error -> 509 pass / 47 fail / 62 error. Default raise mode unchanged at 618 / 0 / 0.
Co-Authored-By: Claude Opus 4.7 [email protected]
Details
- Commit
- 057759034cbd
- Parent
- c8b87a1eacf0
spinel_codegen.rbmodifiedView file
else if pred_type == "float" emit(" mrb_float " + tmp + " = " + pred_val + ";") elsif pred_type == "bigint" @needs_bigint = 1 emit(" mrb_int " + tmp + " = sp_bigint_to_int((sp_Bigint *)" + pred_val + ");") pred_type = "int" else emit(" mrb_int " + tmp + " = " + pred_val + ";") end else if pred_type == "float" emit(" mrb_float " + tmp + " = " + pred_val + ";") elsif pred_type == "bigint" @needs_bigint = 1 emit(" mrb_int " + tmp + " = sp_bigint_to_int((sp_Bigint *)" + pred_val + ");") pred_type = "int" else emit(" mrb_int " + tmp + " = " + pred_val + ";") end