[jit] Avoid a verification error in gsharedvt code with ldarga + gshared types. Fixes...
authorZoltan Varga <vargaz@gmail.com>
Wed, 2 Dec 2015 03:12:50 +0000 (22:12 -0500)
committerZoltan Varga <vargaz@gmail.com>
Wed, 2 Dec 2015 03:12:50 +0000 (22:12 -0500)
mono/mini/method-to-ir.c

index 1f7a6299738f5214fb57c5b066196c3fdb531b9d..7d8ab6d4d8179ffd6ddebf142d28a3827168a95d 100644 (file)
@@ -2191,8 +2191,12 @@ target_type_is_incompatible (MonoCompile *cfg, MonoType *target, MonoInst *arg)
 
        if (target->byref) {
                /* FIXME: check that the pointed to types match */
-               if (arg->type == STACK_MP)
-                       return target->type != MONO_TYPE_I && arg->klass != mono_class_from_mono_type (target);
+               if (arg->type == STACK_MP) {
+                       MonoClass *base_class = mono_class_from_mono_type (target);
+                       /* This is needed to handle gshared types + ldaddr */
+                       simple_type = mini_get_underlying_type (&base_class->byval_arg);
+                       return target->type != MONO_TYPE_I && arg->klass != base_class && arg->klass != mono_class_from_mono_type (simple_type);
+               }
                if (arg->type == STACK_PTR)
                        return 0;
                return 1;