Skip to content

Commit ee4f27a

Browse files
jeplerdpgeorge
authored andcommitted
py/objcell: Fix printing of cell ID/pointer.
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 a hex integer instead. This location was found using an experimental gcc plugin for `mp_printf` error checking. Signed-off-by: Jeff Epler <[email protected]>
1 parent 4495610 commit ee4f27a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

py/objcell.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
static void cell_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) {
3131
(void)kind;
3232
mp_obj_cell_t *o = MP_OBJ_TO_PTR(o_in);
33-
mp_printf(print, "<cell %p ", o->obj);
33+
mp_printf(print, "<cell " HEX_FMT " ", (mp_uint_t)o->obj);
3434
if (o->obj == MP_OBJ_NULL) {
3535
mp_print_str(print, "(nil)");
3636
} else {

0 commit comments

Comments
 (0)