Fix sizeof(T) in non-gshared code. Fixes #580189.
authorAlexandre Mutel <alexandre_mutel@yahoo.fr>
Sun, 13 Feb 2011 15:14:55 +0000 (16:14 +0100)
committerZoltan Varga <vargaz@gmail.com>
Sun, 13 Feb 2011 15:16:57 +0000 (16:16 +0100)
mono/mini/iltests.il.in
mono/mini/method-to-ir.c

index c8de9d04510012c7770bad1ce5f7766b0d5d39bb..565ab748f56de5228c4bc453865f9f7dd8400574 100644 (file)
@@ -2607,4 +2607,19 @@ END:
                ldc.i4.0
                ret
        }
+
+       .method public hidebysig static int32 SizeOfT<T>() cil managed
+       {
+               .maxstack  8
+    
+               sizeof !!0
+       ret
+       }
+
+       .method public static default int32 test_1_sizeof_gshared () cil managed {
+           call   int32 Tests::SizeOfT<int8>()
+               ldc.i4.1
+               ceq
+               ret
+       }
 }
index d2a081c14d65afcccb1e14b21ff26909b9485d87..d075a817729b48fef131b0814ceedc76e5764098 100644 (file)
@@ -10308,7 +10308,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                CHECK_STACK_OVF (1);
                                CHECK_OPSIZE (6);
                                token = read32 (ip + 2);
-                               if (mono_metadata_token_table (token) == MONO_TABLE_TYPESPEC && !method->klass->image->dynamic) {
+                               if (mono_metadata_token_table (token) == MONO_TABLE_TYPESPEC && !method->klass->image->dynamic && !generic_context) {
                                        MonoType *type = mono_type_create_from_typespec (image, token);
                                        token = mono_type_size (type, &ialign);
                                } else {