From a9f74614ab470de9d0edfe2cafb3e1b3e210955a Mon Sep 17 00:00:00 2001 From: Vlad Brezae Date: Fri, 22 Nov 2024 11:32:03 +0200 Subject: [PATCH] [mono][aot] Fix stack state when emitting type load throw Method compilation was continuing and we ended up failing with invalid IL. --- src/mono/mono/mini/method-to-ir.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/mono/mono/mini/method-to-ir.c b/src/mono/mono/mini/method-to-ir.c index b3df7ddac3d31..c874b2179da4e 100644 --- a/src/mono/mono/mini/method-to-ir.c +++ b/src/mono/mono/mini/method-to-ir.c @@ -12112,13 +12112,12 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b break; case MONO_CEE_INITOBJ: klass = mini_get_class (method, token, generic_context); + --sp; if (CLASS_HAS_FAILURE (klass)) { HANDLE_TYPELOAD_ERROR (cfg, klass); inline_costs += 10; break; // reached only in AOT } - - --sp; if (mini_class_is_reference (klass)) MONO_EMIT_NEW_STORE_MEMBASE_IMM (cfg, OP_STORE_MEMBASE_IMM, sp [0]->dreg, 0, 0);