Check return type compatibility for inlined methods as well. Fixes #5056.
authorZoltan Varga <vargaz@gmail.com>
Mon, 14 May 2012 10:15:07 +0000 (12:15 +0200)
committerZoltan Varga <vargaz@gmail.com>
Mon, 14 May 2012 10:16:20 +0000 (12:16 +0200)
mono/mini/method-to-ir.c

index ecbf4a680f47e151e0c4fcaa4a5c8d2d04bcd167..5b1dbc2e59e2afa5606554ff6df0a62fe4152d90 100644 (file)
@@ -7406,9 +7406,15 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                 * (test case: test_0_inline_throw ()).
                                 */
                                if (return_var && cfg->cbb->in_count) {
+                                       MonoType *ret_type = mono_method_signature (method)->ret;
+
                                        MonoInst *store;
                                        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;
+
                                        //g_assert (returnvar != -1);
                                        EMIT_NEW_TEMPSTORE (cfg, store, return_var->inst_c0, *sp);
                                        cfg->ret_var_set = TRUE;