From 5ff2ae5a6c955a5123082ba441ad57fe4908b690 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sun, 15 Jun 2025 08:08:55 +0200 Subject: [PATCH] py/asmbase: Fix assertion error with viper code. In the case of viper code it's possible to reach MP_ASM_PASS_EMIT with a code size of 0 bytes. Update the assertion accordingly. After this change, `mpy-cross -march=debug' on viper tests no longer crashes. Fixes issue #17467. Signed-off-by: Jeff Epler --- py/asmbase.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/py/asmbase.c b/py/asmbase.c index 3fce543a7..f1b823fa3 100644 --- a/py/asmbase.c +++ b/py/asmbase.c @@ -53,7 +53,7 @@ void mp_asm_base_start_pass(mp_asm_base_t *as, int pass) { } else { // allocating executable RAM is platform specific MP_PLAT_ALLOC_EXEC(as->code_offset, (void **)&as->code_base, &as->code_size); - assert(as->code_base != NULL); + assert(as->code_size == 0 || as->code_base != NULL); } as->pass = pass; as->suppress = false;