2008-10-02 Mark Probst <mark.probst@gmail.com>
authorMark Probst <mark.probst@gmail.com>
Thu, 2 Oct 2008 14:19:23 +0000 (14:19 -0000)
committerMark Probst <mark.probst@gmail.com>
Thu, 2 Oct 2008 14:19:23 +0000 (14:19 -0000)
* method-to-ir.c (mono_method_to_ir2): Array methods are
special-cased and must not be invoked indirectly via the (M)RGCTX
when generic sharing is turned on.  Fixes #431413.

2008-10-02  Mark Probst  <mark.probst@gmail.com>

* bug-431413.2.cs: Test for bug #431413 (multidimensional generic
arrays).

* Makefile.am: Test added.

svn path=/trunk/mono/; revision=114668

mono/mini/ChangeLog
mono/mini/method-to-ir.c
mono/tests/ChangeLog
mono/tests/Makefile.am
mono/tests/bug-431413.2.cs [new file with mode: 0644]

index 312a571afb05fe0a32e408b99531cc480a38dd8b..2814b0115cc229d9865a4f3815359fd49ef2690a 100644 (file)
@@ -1,3 +1,9 @@
+2008-10-02  Mark Probst  <mark.probst@gmail.com>
+
+       * method-to-ir.c (mono_method_to_ir2): Array methods are
+       special-cased and must not be invoked indirectly via the (M)RGCTX
+       when generic sharing is turned on.  Fixes #431413.
+
 2008-10-01  Mark Probst  <mark.probst@gmail.com>
 
        * method-to-ir.c: When generic sharing is active, call
index 1033325480f9537730e0ec11420c0de60a251b49..fd6183bd7f19f3f3c57acf1fdc75e0940202fa9a 100644 (file)
@@ -6182,7 +6182,7 @@ mono_method_to_ir2 (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_
                        /* Generic sharing */
                        /* FIXME: only do this for generic methods if
                           they are not shared! */
-                       if (context_used && !imt_arg &&
+                       if (context_used && !imt_arg && !array_rank &&
                                        (!mono_method_is_generic_sharable_impl (cmethod, TRUE) ||
                                                !mono_class_generic_sharing_enabled (cmethod->klass)) &&
                                        (!virtual || cmethod->flags & METHOD_ATTRIBUTE_FINAL ||
index 32ff8cf92545a90606b3aeb93362cb0dcb18a2d9..2ccf265f048f6ecec1df9ad0e394f40fd429f404 100644 (file)
@@ -1,3 +1,10 @@
+2008-10-02  Mark Probst  <mark.probst@gmail.com>
+
+       * bug-431413.2.cs: Test for bug #431413 (multidimensional generic
+       arrays).
+
+       * Makefile.am: Test added.
+
 2008-10-01  Zoltan Varga  <vargaz@gmail.com>
 
        * pinvoke3.cs libtest.c: Add test for byref string marshalling.
index fa4c520d02f071a7a256696b13532be4cd657d34..7353ba8998d8e23c599370149ea8357d3b2b43c8 100644 (file)
@@ -285,6 +285,7 @@ BASE_TEST_CS_SRC=           \
        generic-type-builder.2.cs       \
        generic-synchronized.2.cs       \
        generic-delegate-ctor.2.cs      \
+       bug-431413.2.cs \
        recursive-generics.2.cs \
        bug-80392.2.cs          \
        dynamic-method-access.2.cs      \
@@ -710,7 +711,7 @@ test-generic-sharing : generics-sharing.2.exe shared-generic-methods.2.exe  \
                generic-valuetype-newobj.2.exe generic-valuetype-newobj2.2.exe  \
                generic-getgenericarguments.2.exe generic-type-builder.2.exe    \
                generic-synchronized.2.exe generic-delegate-ctor.2.exe          \
-               generic-constrained.2.exe
+               generic-constrained.2.exe bug-431413.2.exe
        @for fn in $+ ; do      \
                echo "Testing $$fn ...";        \
                MONO_GENERIC_SHARING=all $(RUNTIME) -O=gshared                $$fn > $$fn.stdout || exit 1;     \
diff --git a/mono/tests/bug-431413.2.cs b/mono/tests/bug-431413.2.cs
new file mode 100644 (file)
index 0000000..0a074a1
--- /dev/null
@@ -0,0 +1,32 @@
+using System;
+
+class Test
+{
+       public Test ()
+       {
+
+       }
+
+       static int Main ()
+       {
+               TestMatrix<Test> tMat = new TestMatrix<Test> ();
+               tMat.setStuff (new Test (), 0, 0);
+               return 0;
+       }
+}
+
+class TestMatrix<T>
+{
+       private T[,] _matrix;
+
+       public TestMatrix ()
+       {
+               _matrix = new T[1, 1];
+       }
+
+       public void setStuff (T item, int row, int column)
+       {
+               _matrix[row, column] = item;
+       }
+
+}