Skip to content

Commit

Permalink
Update overlapped field test to conflict on 32-bit arches (#62308)
Browse files Browse the repository at this point in the history
* Update overlapped field test to conflict on 32-bit arches

   Fixes #62303

* [class-init] Setup fields of nested structs in layout check

   On AOT the field's class may not have been fully inited yet.

   Related to #62311
  • Loading branch information
lambdageek authored Dec 3, 2021
1 parent 915ee6d commit eff6546
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/mono/mono/metadata/class-init.c
Original file line number Diff line number Diff line change
Expand Up @@ -1903,7 +1903,7 @@ validate_struct_fields_overlaps (guint8 *layout_check, int layout_size, MonoClas
if (mono_type_is_struct (ftype)) {
// recursively check the layout of the embedded struct
MonoClass *embedded_class = mono_class_from_mono_type_internal (ftype);
g_assert (m_class_is_fields_inited (embedded_class));
mono_class_setup_fields (embedded_class);

const int embedded_fields_count = mono_class_get_field_count (embedded_class);
int *embedded_offsets = g_new0 (int, embedded_fields_count);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public struct SecondLevel
[StructLayout(LayoutKind.Explicit)]
public struct ThirdLevel
{
[FieldOffset(6)]
[FieldOffset(2)]
public short ConflictingValueTypeField;
}

Expand Down

0 comments on commit eff6546

Please sign in to comment.