@@ -4813,20 +4813,16 @@ handle_stelem (TransformData *td, int op)
48134813 * value_var_klass = mono_class_from_mono_type_internal (value_var -> type );
48144814
48154815 if (m_class_is_array (array_var_klass )) {
4816- ERROR_DECL (error );
48174816 MonoClass * array_element_klass = m_class_get_element_class (array_var_klass );
48184817 // If lhs is T[] and rhs is T and T is sealed, we can skip the runtime typecheck
4819- // FIXME: right now this passes for Object[][] since Array is sealed, should it?
4820- gboolean isinst ;
4821- // Make sure lhs and rhs element types are compatible, even though they usually would be
4822- mono_class_is_assignable_from_checked (array_element_klass , value_var_klass , & isinst , error );
4823- mono_error_cleanup (error ); // FIXME: do not swallow the error
4824- if (isinst &&
4825- // We already know lhs and rhs are compatible, so if they're both sealed they
4826- // should be the same exactly
4827- m_class_is_sealed (array_element_klass ) &&
4828- m_class_is_sealed (value_var_klass )
4829- ) {
4818+ if (
4819+ (array_element_klass == value_var_klass ) &&
4820+ m_class_is_sealed (value_var_klass ) &&
4821+ // HACK: Arrays are sealed, but it's possible to downcast string[][] to object[][],
4822+ // so we don't want to treat elements of array types as actually sealed.
4823+ // Our lhs of type object[][] might actually be of a different reference type.
4824+ !m_class_is_array (value_var_klass )
4825+ ){
48304826 if (td -> verbose_level > 2 )
48314827 g_printf (
48324828 "MINT_STELEM_REF_UNCHECKED for %s in %s::%s\n" ,
0 commit comments