mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
3cc60d31c6
On 32-bit platforms whose ABI gives 8-byte members 8-byte alignment (xtensa, ARM, MIPS, PowerPC, ...), MRB_NAN_BOXING failed to build with "RVALUE size must be within 5 words" because two structs got padded past the budget: - struct RBreak: had an existing MRB_USE_RBREAK_VALUE_UNION workaround that stores the value as uint32_t[] to avoid forcing 8-byte alignment on the struct, but the gate only enabled it for MRB_NO_BOXING. Extend to NAN_BOXING + 32-bit, with a NAN_BOXING-specific get/set (no separate tt to stash since nan-boxing encodes type in the bits). - struct RArray: MRB_ARY_NO_EMBED was similarly gated to NO_BOXING; embedded mrb_value[] forces 8-byte alignment of the inner union and pads the heap-form layout. Extend the gate to NAN_BOXING + 32-bit. Both gates now name the structural property (32-bit + mrb_value has an 8-byte aligned member) rather than enumerating boxing modes, so adding new boxing modes won't silently miss this class of bug again. i386's System V ABI gives uint64_t only 4-byte alignment, hiding the problem on x86 -m32; -malign-double simulates the strict-alignment ABI that exhibits the failure, and is what was used to verify the fix. Closes #6815, reported by dearblue. Co-authored-by: Claude <noreply@anthropic.com>