From eaaa66b39b15f5b42bc5e9f4ccd5a6784644d1f3 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Fri, 27 Feb 2026 09:55:21 +0900 Subject: [PATCH] mrbconf.h: prohibit MRB_INT64 on 32-bit with word/NaN boxing Heap-allocated RInteger with int64_t requires 8-byte alignment, but GC heap slots on 32-bit may not guarantee it, causing SIGBUS on architectures like MIPS. MRB_NO_BOXING is still allowed since integers are stored inline in mrb_value (no heap RInteger). Co-authored-by: Claude --- include/mrbconf.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/mrbconf.h b/include/mrbconf.h index 915b5001f..b10f55c8f 100644 --- a/include/mrbconf.h +++ b/include/mrbconf.h @@ -86,6 +86,13 @@ # endif #endif +/* MRB_INT64 on 32-bit with word/NaN boxing causes alignment issues + for heap-allocated RInteger (int64_t needs 8-byte alignment but + GC heap slots may not guarantee it); use MRB_NO_BOXING instead */ +#if defined(MRB_INT64) && defined(MRB_32BIT) && !defined(MRB_NO_BOXING) +#error "MRB_INT64 on 32-bit requires MRB_NO_BOXING" +#endif + /* call malloc_trim(0) from mrb_full_gc() */ //#define MRB_USE_MALLOC_TRIM