+2009-01-07 Rodrigo Kumpera <rkumpera@novell.com>
+
+ Backport of r122579 - r122585.
+
+ * verify.c (mono_class_interface_implements_interface): Verify parents as we can't rely on
+ interfaces_packed here.
+
+ Fixes part of #463294.
+
+ * verify.c (is_array_type_compatible): Ignore bounds and sizes when checking array compatibility.
+
+ Fixes part of #463294.
+
+ * verify.c (stack_slot_is_complex_type_not_reference_type): Check if the type
+ is a boxed complex as well.
+
+ Fixes part of #463294.
+
2008-11-27 Mark Probst <mark.probst@gmail.com>
Backport of r120164.
mono_class_interface_implements_interface (MonoClass *candidate, MonoClass *iface)
{
int i;
- if (candidate == iface)
- return TRUE;
- for (i = 0; i < candidate->interface_count; ++i) {
- if (candidate->interfaces [i] == iface || mono_class_interface_implements_interface (candidate->interfaces [i], iface))
+ do {
+ if (candidate == iface)
return TRUE;
- }
+ for (i = 0; i < candidate->interface_count; ++i) {
+ if (candidate->interfaces [i] == iface || mono_class_interface_implements_interface (candidate->interfaces [i], iface))
+ return TRUE;
+ }
+ candidate = candidate->parent;
+ } while (candidate);
return FALSE;
}
static gboolean
is_array_type_compatible (MonoType *target, MonoType *candidate)
{
- int i;
MonoArrayType *left = target->data.array;
MonoArrayType *right = candidate->data.array;
g_assert (target->type == MONO_TYPE_ARRAY);
g_assert (candidate->type == MONO_TYPE_ARRAY);
-
- if ((left->rank != right->rank) ||
- (left->numsizes != right->numsizes) ||
- (left->numlobounds != right->numlobounds))
+ if (left->rank != right->rank)
return FALSE;
- for (i = 0; i < left->numsizes; ++i)
- if (left->sizes [i] != right->sizes [i])
- return FALSE;
-
- for (i = 0; i < left->numlobounds; ++i)
- if (left->lobounds [i] != right->lobounds [i])
- return FALSE;
-
return mono_class_is_assignable_from (left->eklass, right->eklass);
}
static gboolean
stack_slot_is_complex_type_not_reference_type (ILStackDesc *slot)
{
- return stack_slot_get_type (slot) == TYPE_COMPLEX && !MONO_TYPE_IS_REFERENCE (slot->type);
+ return stack_slot_get_type (slot) == TYPE_COMPLEX && !MONO_TYPE_IS_REFERENCE (slot->type) && !stack_slot_is_boxed_value (slot);
}
static void
+2009-01-07 Rodrigo Kumpera <rkumpera@novell.com>
+
+ Backport of r122579 - r122585.
+
+ * valid_iface_constant_with_parent_implementing_it.il:
+ Regression test for #461200.
+
+ * valid_array_compat_with_bonds_and_sizes.il:
+ * valid_array_compat_with_bounds.il:
+ * valid_array_compat_with_sizes.il: Regression tests for
+ #461200.
+
+ * valid_ceq_with_boxed_vt.il: Regression test for #461200.
+
2008-09-03 Rodrigo Kumpera <rkumpera@novell.com>
* strict_native_int_converts_to_unamanged_pointer.cs: It turns
--- /dev/null
+.assembly extern mscorlib
+{
+ .ver 2:0:0:0
+ .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
+}
+.assembly 'repro'
+{
+
+ .hash algorithm 0x00008004
+ .ver 0:0:0:0
+}
+.module repro.exe
+
+.class private auto ansi beforefieldinit Driver extends [mscorlib]System.Object
+{
+ .method public static hidebysig default int32 Test () cil managed
+ {
+ .maxstack 8
+ .locals init (int32[1...4, 3...8] V_0)
+
+ ldloc.0
+ ldc.i4.0
+ ldc.i4.0
+ callvirt instance int32 int32[,]::Get(int32, int32)
+ ret
+ }
+
+
+ .method private static hidebysig default int32 Main () cil managed
+ {
+ .entrypoint
+ .maxstack 8
+ .locals init ()
+
+ call int32 class Driver::Test ()
+ ret
+ }
+}
+
--- /dev/null
+.assembly extern mscorlib
+{
+ .ver 2:0:0:0
+ .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
+}
+.assembly 'repro'
+{
+
+ .hash algorithm 0x00008004
+ .ver 0:0:0:0
+}
+.module repro.exe
+
+.class private auto ansi beforefieldinit Driver extends [mscorlib]System.Object
+{
+ .method public static hidebysig default int32 Test () cil managed
+ {
+ .maxstack 8
+ .locals init (int32[4..., 4...] V_0)
+
+ ldloc.0
+ ldc.i4.0
+ ldc.i4.0
+ callvirt instance int32 int32[,]::Get(int32, int32)
+ ret
+ }
+
+
+ .method private static hidebysig default int32 Main () cil managed
+ {
+ .entrypoint
+ .maxstack 8
+ .locals init ()
+
+ call int32 class Driver::Test ()
+ ret
+ }
+}
+
--- /dev/null
+.assembly extern mscorlib
+{
+ .ver 2:0:0:0
+ .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
+}
+.assembly 'repro'
+{
+
+ .hash algorithm 0x00008004
+ .ver 0:0:0:0
+}
+.module repro.exe
+
+.class private auto ansi beforefieldinit Driver extends [mscorlib]System.Object
+{
+ .method public static hidebysig default int32 Test () cil managed
+ {
+ .maxstack 8
+ .locals init (int32[4, 8] V_0)
+
+ ldloc.0
+ ldc.i4.0
+ ldc.i4.0
+ callvirt instance int32 int32[,]::Get(int32, int32)
+ ret
+ }
+
+
+ .method private static hidebysig default int32 Main () cil managed
+ {
+ .entrypoint
+ .maxstack 8
+ .locals init ()
+
+ call int32 class Driver::Test ()
+ ret
+ }
+}
+
--- /dev/null
+.assembly extern mscorlib
+{
+ .ver 2:0:0:0
+ .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
+}
+.assembly 'repro'
+{
+
+ .hash algorithm 0x00008004
+ .ver 0:0:0:0
+}
+.module repro.exe
+
+.class private auto ansi beforefieldinit Driver extends [mscorlib]System.Object
+{
+ .method public static hidebysig default int32 Test<T> (!!T val) cil managed
+ {
+ .maxstack 8
+ .locals init ()
+ ldarg.0
+ box !!T
+ ldnull
+ ceq
+ ret
+ }
+
+
+ .method private static hidebysig default int32 Main () cil managed
+ {
+ .entrypoint
+ .maxstack 8
+ .locals init ()
+
+ ldc.i4.0
+ call int32 class Driver::Test<int32> (!!0)
+ ret
+ }
+}
+
--- /dev/null
+.assembly extern mscorlib
+{
+ .ver 2:0:0:0
+ .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
+}
+.assembly 'repro'
+{
+
+ .hash algorithm 0x00008004
+ .ver 0:0:0:0
+}
+.module repro.exe
+
+.class interface public auto ansi abstract INameable {}
+.class public auto ansi abstract Base implements INameable {}
+.class public auto ansi abstract Derived extends Base {}
+
+ .class public auto ansi Nameables<(class INameable) T>
+{
+ .method public specialname rtspecialname instance default void '.ctor' () cil managed
+ {
+ .maxstack 8
+ ldarg.0
+ call instance void object::'.ctor'()
+ ret
+ }
+}
+
+
+.class auto ansi beforefieldinit Driver extends [mscorlib]System.Object
+{
+ .method public static hidebysig default int32 Test () cil managed
+ {
+ .maxstack 8
+ .locals init ()
+ newobj instance void class Nameables<class Derived>::'.ctor'()
+ pop
+ ldc.i4.0
+ ret
+ }
+
+
+ .method private static hidebysig default int32 Main () cil managed
+ {
+ .entrypoint
+ .maxstack 8
+ .locals init ()
+
+ call int32 class Driver::Test ()
+ ret
+ }
+}
+