In metadata:
authorRodrigo Kumpera <kumpera@gmail.com>
Wed, 7 Jan 2009 12:48:50 +0000 (12:48 -0000)
committerRodrigo Kumpera <kumpera@gmail.com>
Wed, 7 Jan 2009 12:48:50 +0000 (12:48 -0000)
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.

In tests/verifier:
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.

svn path=/branches/mono-2-2/mono/; revision=122650

mono/metadata/ChangeLog
mono/metadata/verify.c
mono/tests/verifier/ChangeLog
mono/tests/verifier/valid_array_compat_with_bonds_and_sizes.il [new file with mode: 0644]
mono/tests/verifier/valid_array_compat_with_bounds.il [new file with mode: 0644]
mono/tests/verifier/valid_array_compat_with_sizes.il [new file with mode: 0644]
mono/tests/verifier/valid_ceq_with_boxed_vt.il [new file with mode: 0644]
mono/tests/verifier/valid_iface_constant_with_parent_implementing_it.il [new file with mode: 0644]

index a82c0757cefe9afccaf32d053cc8193f60813671..74cdce81e3ccfff551529444cff9d2254cde7323 100644 (file)
@@ -1,3 +1,21 @@
+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.
index 96771dbd47b72356b4ab56273d4d80fb178acef3..4f2765b1443ad814edc6aca1482333263f8d44ad 100644 (file)
@@ -379,12 +379,15 @@ static gboolean
 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;
 }
 
@@ -2150,27 +2153,15 @@ dump_stack_state (ILCodeDesc *state)
 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);
 }
 
@@ -3006,7 +2997,7 @@ do_boolean_branch_op (VerifyContext *ctx, int delta)
 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
index 93ea2a057e9b214711662b56acdd0f9b972ee496..9224c75c298ee9a88a66a4357023ae0945104c1a 100644 (file)
@@ -1,3 +1,17 @@
+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
diff --git a/mono/tests/verifier/valid_array_compat_with_bonds_and_sizes.il b/mono/tests/verifier/valid_array_compat_with_bonds_and_sizes.il
new file mode 100644 (file)
index 0000000..705cd69
--- /dev/null
@@ -0,0 +1,39 @@
+.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
+       }
+}
+
diff --git a/mono/tests/verifier/valid_array_compat_with_bounds.il b/mono/tests/verifier/valid_array_compat_with_bounds.il
new file mode 100644 (file)
index 0000000..c13d491
--- /dev/null
@@ -0,0 +1,39 @@
+.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
+       }
+}
+
diff --git a/mono/tests/verifier/valid_array_compat_with_sizes.il b/mono/tests/verifier/valid_array_compat_with_sizes.il
new file mode 100644 (file)
index 0000000..a3c481d
--- /dev/null
@@ -0,0 +1,39 @@
+.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
+       }
+}
+
diff --git a/mono/tests/verifier/valid_ceq_with_boxed_vt.il b/mono/tests/verifier/valid_ceq_with_boxed_vt.il
new file mode 100644 (file)
index 0000000..0b5c2c8
--- /dev/null
@@ -0,0 +1,39 @@
+.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
+       }
+}
+
diff --git a/mono/tests/verifier/valid_iface_constant_with_parent_implementing_it.il b/mono/tests/verifier/valid_iface_constant_with_parent_implementing_it.il
new file mode 100644 (file)
index 0000000..56ee304
--- /dev/null
@@ -0,0 +1,53 @@
+.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
+       }
+}
+