1 // C# source. Compiling this code with mcs didn't produce the necessary output
3 // public struct Struct1 {
9 // public struct Struct2 {
14 // public class MyArray {
16 // private Struct1[] array;
20 // array = new Struct1 [2];
23 // array [0].f2.f1 = 2;
24 // array [0].f2.f2 = 3;
28 // array [1].f2.f1 = 6;
29 // array [1].f2.f2 = 7;
33 // public Struct1 this [int index]
36 // return array [index];
38 // array [index] = value;
43 // public class Program {
44 // public static int Check (Struct2 s1, Struct2 s2)
46 // if (s1.f1 == 2 && s1.f2 == 3 && s2.f1 == 6 && s2.f2 == 7)
51 // public static int Check (MyArray array)
53 // return Check (array [0].f2, array [1].f2);
56 // public static int Main (string[] args)
58 // MyArray array = new MyArray ();
59 // return Check (array);
63 .assembly extern mscorlib
66 .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
70 .custom instance void class [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::'.ctor'(int32) = (01 00 08 00 00 00 00 00 ) // ........
72 .custom instance void class [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::'.ctor'() = (
73 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
74 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
76 .custom instance void class [mscorlib]System.Diagnostics.DebuggableAttribute::'.ctor'(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = (01 00 07 01 00 00 00 00 ) // ........
78 .custom instance void class [mscorlib]System.Reflection.AssemblyTitleAttribute::'.ctor'(string) = (01 00 02 56 54 00 00 ) // ...VT..
80 .custom instance void class [mscorlib]System.Reflection.AssemblyDescriptionAttribute::'.ctor'(string) = (01 00 00 00 00 ) // .....
82 .custom instance void class [mscorlib]System.Reflection.AssemblyConfigurationAttribute::'.ctor'(string) = (01 00 00 00 00 ) // .....
84 .custom instance void class [mscorlib]System.Reflection.AssemblyCompanyAttribute::'.ctor'(string) = (01 00 00 00 00 ) // .....
86 .custom instance void class [mscorlib]System.Reflection.AssemblyProductAttribute::'.ctor'(string) = (01 00 02 56 54 00 00 ) // ...VT..
88 .custom instance void class [mscorlib]System.Reflection.AssemblyCopyrightAttribute::'.ctor'(string) = (
89 01 00 12 43 6F 70 79 72 69 67 68 74 20 C2 A9 20 // ...Copyright ..
90 20 32 30 31 38 00 00 ) // 2018..
92 .custom instance void class [mscorlib]System.Reflection.AssemblyTrademarkAttribute::'.ctor'(string) = (01 00 00 00 00 ) // .....
94 .custom instance void class [mscorlib]System.Runtime.InteropServices.ComVisibleAttribute::'.ctor'(bool) = (01 00 00 00 00 ) // .....
96 .custom instance void class [mscorlib]System.Runtime.InteropServices.GuidAttribute::'.ctor'(string) = (
97 01 00 24 33 65 32 39 35 61 63 31 2D 65 61 34 32 // ..$3e295ac1-ea42
98 2D 34 64 30 38 2D 38 62 61 32 2D 65 37 66 62 61 // -4d08-8ba2-e7fba
99 66 37 31 30 61 38 63 00 00 ) // f710a8c..
101 .custom instance void class [mscorlib]System.Reflection.AssemblyFileVersionAttribute::'.ctor'(string) = (01 00 07 31 2E 30 2E 30 2E 30 00 00 ) // ...1.0.0.0..
103 .custom instance void class [mscorlib]System.Runtime.Versioning.TargetFrameworkAttribute::'.ctor'(string) = (
104 01 00 1C 2E 4E 45 54 46 72 61 6D 65 77 6F 72 6B // ....NETFramework
105 2C 56 65 72 73 69 6F 6E 3D 76 34 2E 36 2E 31 01 // ,Version=v4.6.1.
106 00 54 0E 14 46 72 61 6D 65 77 6F 72 6B 44 69 73 // .T..FrameworkDis
107 70 6C 61 79 4E 61 6D 65 14 2E 4E 45 54 20 46 72 // playName..NET Fr
108 61 6D 65 77 6F 72 6B 20 34 2E 36 2E 31 ) // amework 4.6.1
110 .hash algorithm 0x00008004
113 .module VT.exe // GUID = {EC2F1E5D-A3E0-493A-8462-E24A6A70FF38}
116 .class public sequential ansi sealed beforefieldinit Struct1
117 extends [mscorlib]System.ValueType
119 .field public int32 f1
120 .field public valuetype Struct2 f2
121 .field public int32 f3
123 } // end of class Struct1
125 .class public sequential ansi sealed beforefieldinit Struct2
126 extends [mscorlib]System.ValueType
128 .field public int32 f1
129 .field public int32 f2
131 } // end of class Struct2
133 .class public auto ansi beforefieldinit MyArray
134 extends [mscorlib]System.Object
136 .custom instance void class [mscorlib]System.Reflection.DefaultMemberAttribute::'.ctor'(string) = (01 00 04 49 74 65 6D 00 00 ) // ...Item..
138 .field private valuetype Struct1[] 'array'
141 .method public hidebysig specialname rtspecialname
142 instance default void '.ctor' () cil managed
144 // Method begins at RVA 0x2050
145 // Code size 185 (0xb9)
148 IL_0001: call instance void object::'.ctor'()
153 IL_000a: newarr Struct1
154 IL_000f: stfld valuetype Struct1[] MyArray::'array'
156 IL_0015: ldfld valuetype Struct1[] MyArray::'array'
158 IL_001b: ldelema Struct1
160 IL_0021: stfld int32 Struct1::f1
162 IL_0027: ldfld valuetype Struct1[] MyArray::'array'
164 IL_002d: ldelema Struct1
165 IL_0032: ldflda valuetype Struct2 Struct1::f2
167 IL_0038: stfld int32 Struct2::f1
169 IL_003e: ldfld valuetype Struct1[] MyArray::'array'
171 IL_0044: ldelema Struct1
172 IL_0049: ldflda valuetype Struct2 Struct1::f2
174 IL_004f: stfld int32 Struct2::f2
176 IL_0055: ldfld valuetype Struct1[] MyArray::'array'
178 IL_005b: ldelema Struct1
180 IL_0061: stfld int32 Struct1::f3
182 IL_0067: ldfld valuetype Struct1[] MyArray::'array'
184 IL_006d: ldelema Struct1
186 IL_0073: stfld int32 Struct1::f1
188 IL_0079: ldfld valuetype Struct1[] MyArray::'array'
190 IL_007f: ldelema Struct1
191 IL_0084: ldflda valuetype Struct2 Struct1::f2
193 IL_008a: stfld int32 Struct2::f1
195 IL_0090: ldfld valuetype Struct1[] MyArray::'array'
197 IL_0096: ldelema Struct1
198 IL_009b: ldflda valuetype Struct2 Struct1::f2
200 IL_00a1: stfld int32 Struct2::f2
202 IL_00a7: ldfld valuetype Struct1[] MyArray::'array'
204 IL_00ad: ldelema Struct1
206 IL_00b3: stfld int32 Struct1::f3
208 } // end of method MyArray::.ctor
211 .method public hidebysig specialname
212 instance default valuetype Struct1 get_Item (int32 index) cil managed
214 // Method begins at RVA 0x2118
215 // Code size 18 (0x12)
218 valuetype Struct1 V_0)
221 IL_0002: ldfld valuetype Struct1[] MyArray::'array'
223 IL_0008: ldelem Struct1
225 IL_000e: br.s IL_0010
229 } // end of method MyArray::get_Item
232 .method public hidebysig specialname
233 instance default void set_Item (int32 index, valuetype Struct1 'value') cil managed
235 // Method begins at RVA 0x2136
236 // Code size 15 (0xf)
240 IL_0002: ldfld valuetype Struct1[] MyArray::'array'
243 IL_0009: stelem Struct1
245 } // end of method MyArray::set_Item
247 .property instance valuetype Struct1 Item (int32)
249 .get instance default valuetype Struct1 MyArray::get_Item (int32 index)
250 .set instance default void MyArray::set_Item (int32 index, valuetype Struct1 'value')
252 } // end of class MyArray
254 .class public auto ansi beforefieldinit Program
255 extends [mscorlib]System.Object
259 .method public static hidebysig
260 default int32 Check (valuetype Struct2 s1, valuetype Struct2 s2) cil managed
262 // Method begins at RVA 0x2148
263 // Code size 54 (0x36)
270 IL_0002: ldfld int32 Struct2::f1
272 IL_0008: bne.un.s IL_0027
275 IL_000b: ldfld int32 Struct2::f2
277 IL_0011: bne.un.s IL_0027
280 IL_0014: ldfld int32 Struct2::f1
282 IL_001a: bne.un.s IL_0027
285 IL_001d: ldfld int32 Struct2::f2
288 IL_0025: br.s IL_0028
293 IL_002a: brfalse.s IL_0030
297 IL_002e: br.s IL_0034
301 IL_0032: br.s IL_0034
305 } // end of method Program::Check
308 .method public static hidebysig
309 default int32 Check (class MyArray 'array') cil managed
311 // Method begins at RVA 0x218c
312 // Code size 35 (0x23)
319 IL_0003: callvirt instance valuetype Struct1 class MyArray::get_Item(int32)
320 IL_0008: ldfld valuetype Struct2 Struct1::f2
323 IL_000f: callvirt instance valuetype Struct1 class MyArray::get_Item(int32)
324 IL_0014: ldfld valuetype Struct2 Struct1::f2
325 IL_0019: call int32 class Program::Check(valuetype Struct2, valuetype Struct2)
327 IL_001f: br.s IL_0021
331 } // end of method Program::Check
334 .method public static hidebysig
335 default int32 Main (string[] args) cil managed
337 // Method begins at RVA 0x21bc
339 // Code size 18 (0x12)
345 IL_0001: newobj instance void class MyArray::'.ctor'()
348 IL_0008: call int32 class Program::Check(class MyArray)
350 IL_000e: br.s IL_0010
354 } // end of method Program::Main
357 .method public hidebysig specialname rtspecialname
358 instance default void '.ctor' () cil managed
360 // Method begins at RVA 0x21da
364 IL_0001: call instance void object::'.ctor'()
367 } // end of method Program::.ctor
369 } // end of class Program