File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
src/mono/mono/mini/interp Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -4751,11 +4751,20 @@ handle_stelem (TransformData *td, int op)
4751
4751
* value_var_klass = mono_class_from_mono_type_internal (value_var -> type );
4752
4752
4753
4753
if (m_class_is_array (array_var_klass )) {
4754
+ ERROR_DECL (error );
4754
4755
MonoClass * array_element_klass = m_class_get_element_class (array_var_klass );
4755
4756
// If lhs is T[] and rhs is T and T is sealed, we can skip the runtime typecheck
4756
4757
// FIXME: right now this passes for Object[][] since Array is sealed, should it?
4757
- if (m_class_is_sealed (array_element_klass ) &&
4758
- m_class_is_sealed (value_var_klass )) {
4758
+ gboolean isinst ;
4759
+ // Make sure lhs and rhs element types are compatible, even though they usually would be
4760
+ mono_class_is_assignable_from_checked (array_element_klass , value_var_klass , & isinst , error );
4761
+ mono_error_cleanup (error ); // FIXME: do not swallow the error
4762
+ if (isinst &&
4763
+ // We already know lhs and rhs are compatible, so if they're both sealed they
4764
+ // should be the same exactly
4765
+ m_class_is_sealed (array_element_klass ) &&
4766
+ m_class_is_sealed (value_var_klass )
4767
+ ) {
4759
4768
if (td -> verbose_level > 2 )
4760
4769
g_printf (
4761
4770
"MINT_STELEM_REF_UNCHECKED for %s in %s::%s\n" ,
You can’t perform that action at this time.
0 commit comments