From: Aleksey Kliger (λgeek) Date: Fri, 3 Dec 2021 19:43:21 +0000 (-0500) Subject: Update overlapped field test to conflict on 32-bit arches (#62308) X-Git-Tag: accepted/tizen/unified/riscv/20231226.055536~11983 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=eff6546c2e38f3eec9e2770819491165a570c1a4;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Update overlapped field test to conflict on 32-bit arches (#62308) * Update overlapped field test to conflict on 32-bit arches Fixes https://github.com/dotnet/runtime/issues/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 https://github.com/dotnet/runtime/issues/62311 --- diff --git a/src/mono/mono/metadata/class-init.c b/src/mono/mono/metadata/class-init.c index c53f4e5..a7c333a 100644 --- a/src/mono/mono/metadata/class-init.c +++ b/src/mono/mono/metadata/class-init.c @@ -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); diff --git a/src/tests/Loader/classloader/explicitlayout/NestedStructs/case04.cs b/src/tests/Loader/classloader/explicitlayout/NestedStructs/case04.cs index 7e2cfc4..c89bea2e 100644 --- a/src/tests/Loader/classloader/explicitlayout/NestedStructs/case04.cs +++ b/src/tests/Loader/classloader/explicitlayout/NestedStructs/case04.cs @@ -27,7 +27,7 @@ public struct SecondLevel [StructLayout(LayoutKind.Explicit)] public struct ThirdLevel { - [FieldOffset(6)] + [FieldOffset(2)] public short ConflictingValueTypeField; }