From c1722ad4867d865c095714cfec921eef36216354 Mon Sep 17 00:00:00 2001 From: Graeme Winter Date: Wed, 24 May 2023 06:43:51 +0100 Subject: [PATCH] Additional cast through void* Tell the compiler we know what we are doing, and that the bytes are correctly aligned, to avoid compiler warning: error: cast increases required alignment of target type --- extmod/moductypes.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extmod/moductypes.c b/extmod/moductypes.c index f770ead006..38f700c055 100644 --- a/extmod/moductypes.c +++ b/extmod/moductypes.c @@ -544,7 +544,7 @@ STATIC mp_obj_t uctypes_struct_subscr(mp_obj_t base_in, mp_obj_t index_in, mp_ob } } else if (agg_type == PTR) { - byte *p = *(void **)self->addr; + byte *p = *(void **)(void *)self->addr; if (mp_obj_is_small_int(t->items[1])) { uint val_type = GET_TYPE(MP_OBJ_SMALL_INT_VALUE(t->items[1]), VAL_TYPE_BITS); return get_aligned(val_type, p, index); @@ -574,7 +574,7 @@ STATIC mp_obj_t uctypes_struct_unary_op(mp_unary_op_t op, mp_obj_t self_in) { mp_int_t offset = MP_OBJ_SMALL_INT_VALUE(t->items[0]); uint agg_type = GET_TYPE(offset, AGG_TYPE_BITS); if (agg_type == PTR) { - byte *p = *(void **)self->addr; + byte *p = *(void **)(void *)self->addr; return mp_obj_new_int((mp_int_t)(uintptr_t)p); } }