Use 2 phase dynamic load only for compound operations
authorMarek Safar <marek.safar@gmail.com>
Wed, 13 Oct 2010 17:00:49 +0000 (18:00 +0100)
committerMarek Safar <marek.safar@gmail.com>
Thu, 14 Oct 2010 09:52:01 +0000 (10:52 +0100)
mcs/mcs/expression.cs
mcs/tests/dtest-035.cs
mcs/tests/ver-il-dmcs.xml

index cf3e41438e05c5fdd4c747c11c68a8a6152d7f66..36198ba595d1188625fcd2d58d521c124fc9e6aa 100644 (file)
@@ -8084,7 +8084,7 @@ namespace Mono.CSharp {
                        // Same cannot be done for reference type because array covariance and the
                        // check in ldelema requires to specify the type of array element stored at the index
                        //
-                       if (t.IsStruct && (prepare_for_load || !TypeManager.IsPrimitiveType (t)) && !(source is DynamicExpressionStatement)) {
+                       if (t.IsStruct && ((prepare_for_load && !(source is DynamicExpressionStatement)) || !TypeManager.IsPrimitiveType (t))) {
                                LoadArrayAndArguments (ec);
                                ec.EmitArrayAddress (ac);
 
index 3bce04a29e0c35d8f4d637fac76a2f9a6c78b7d1..6f83bc2d2bf417aae733b2fc103fb5156a7758a6 100644 (file)
@@ -66,6 +66,12 @@ public class Test
                iar [0] += dvalue;
                if (iar [0] != -11)
                        return 5;
+               
+               dynamic dn = 1;
+               int?[] array = new int?[1];
+               array[0] = dn;
+               if (array [0] != 1)
+                       return 6;
 
                Console.WriteLine ("ok");
                return 0;
index 00a067c7228fa716bb910dc00ab21b4440b6e416..d50dc82ffe540cc020a93f5f3388f888935159e7 100644 (file)
         <size>74</size>
       </method>
       <method name="Int32 Main()">
-        <size>1039</size>
+        <size>1181</size>
       </method>
       <method name="Void .ctor()">
         <size>18</size>