[jit] Fix a verification error when using partial sharing.
authorZoltan Varga <vargaz@gmail.com>
Thu, 3 Dec 2015 18:51:42 +0000 (13:51 -0500)
committerZoltan Varga <vargaz@gmail.com>
Thu, 3 Dec 2015 18:51:42 +0000 (13:51 -0500)
mono/mini/method-to-ir.c

index 7d8ab6d4d8179ffd6ddebf142d28a3827168a95d..bbe1f46dde715a95e0c2eec9d1c3218e37ee5a5f 100644 (file)
@@ -2268,11 +2268,13 @@ target_type_is_incompatible (MonoCompile *cfg, MonoType *target, MonoInst *arg)
                return 0;
        case MONO_TYPE_GENERICINST:
                if (mono_type_generic_inst_is_valuetype (simple_type)) {
+                       MonoClass *target_class;
                        if (arg->type != STACK_VTYPE)
                                return 1;
                        klass = mono_class_from_mono_type (simple_type);
+                       target_class = mono_class_from_mono_type (target);
                        /* The second cases is needed when doing partial sharing */
-                       if (klass != arg->klass && mono_class_from_mono_type (target) != arg->klass)
+                       if (klass != arg->klass && target_class != arg->klass && target_class != mono_class_from_mono_type (mini_get_underlying_type (&arg->klass->byval_arg)))
                                return 1;
                        return 0;
                } else {