Check TOS for compatibility with return type.
authorRodrigo Kumpera <kumpera@gmail.com>
Fri, 26 Nov 2010 15:44:01 +0000 (13:44 -0200)
committerRodrigo Kumpera <kumpera@gmail.com>
Fri, 26 Nov 2010 17:30:15 +0000 (15:30 -0200)
* method-to-ir.c (mono_method_to_ir): Check if TOS
is store compatible with the return type of the
current method.

Fixes #655497

mono/mini/method-to-ir.c

index fa557064bc6daffb693b063f262726276d48c9b3..b7c793d0b3f1e8fde64ed6c0f433f24af1e0a404 100644 (file)
@@ -7153,6 +7153,10 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                        g_assert (!return_var);
                                        CHECK_STACK (1);
                                        --sp;
+
+                                       if ((method->wrapper_type == MONO_WRAPPER_DYNAMIC_METHOD || method->wrapper_type == MONO_WRAPPER_NONE) && target_type_is_incompatible (cfg, ret_type, *sp))
+                                               UNVERIFIED;
+
                                        if (mini_type_to_stind (cfg, ret_type) == CEE_STOBJ) {
                                                MonoInst *ret_addr;