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 <jepler@gmail.com>
This commit is contained in:
Jeff Epler
2025-06-15 08:08:55 +02:00
committed by Damien George
parent fc6205c4f0
commit 5ff2ae5a6c

View File

@@ -53,7 +53,7 @@ void mp_asm_base_start_pass(mp_asm_base_t *as, int pass) {
} else { } else {
// allocating executable RAM is platform specific // allocating executable RAM is platform specific
MP_PLAT_ALLOC_EXEC(as->code_offset, (void **)&as->code_base, &as->code_size); 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->pass = pass;
as->suppress = false; as->suppress = false;