Skip to content

Commit eff6546

Browse files
authored
Update overlapped field test to conflict on 32-bit arches (#62308)
* 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
1 parent 915ee6d commit eff6546

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/mono/mono/metadata/class-init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1903,7 +1903,7 @@ validate_struct_fields_overlaps (guint8 *layout_check, int layout_size, MonoClas
19031903
if (mono_type_is_struct (ftype)) {
19041904
// recursively check the layout of the embedded struct
19051905
MonoClass *embedded_class = mono_class_from_mono_type_internal (ftype);
1906-
g_assert (m_class_is_fields_inited (embedded_class));
1906+
mono_class_setup_fields (embedded_class);
19071907

19081908
const int embedded_fields_count = mono_class_get_field_count (embedded_class);
19091909
int *embedded_offsets = g_new0 (int, embedded_fields_count);

src/tests/Loader/classloader/explicitlayout/NestedStructs/case04.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public struct SecondLevel
2727
[StructLayout(LayoutKind.Explicit)]
2828
public struct ThirdLevel
2929
{
30-
[FieldOffset(6)]
30+
[FieldOffset(2)]
3131
public short ConflictingValueTypeField;
3232
}
3333

0 commit comments

Comments
 (0)