objcell: Fix printing cell ID.

On the nanbox build, `o->obj` is a 64-bit type but `%p` formats
a 32-bit type, leading to undefined behavior.

Print the cell's ID as an integer instead.

It can't be printed in hex because the '%llx' format specifier is not
supported in mp_printf.

This location was found using an experimental gcc plugin for mp_printf
error checking.

Signed-off-by: Jeff Epler <jepler@gmail.com>
This commit is contained in:
Jeff Epler 2025-07-05 09:34:29 +01:00
parent dc3cb7eb91
commit f34089b312

View file

@ -30,7 +30,8 @@
static void cell_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) {
(void)kind;
mp_obj_cell_t *o = MP_OBJ_TO_PTR(o_in);
mp_printf(print, "<cell %p ", o->obj);
MP_STATIC_ASSERT(sizeof(mp_obj_t) == sizeof(mp_uint_t));
mp_printf(print, "<cell " UINT_FMT " ", (mp_uint_t)o->obj);
if (o->obj == MP_OBJ_NULL) {
mp_print_str(print, "(nil)");
} else {