Reduce TLS accesses. (#11487)
[mono-project.git] / mono / tests / bug-6148.cs
blobfd9b26f1a56050a0dd08c7f9e1b004aed792b411
1 using System;
2 using System.Runtime.InteropServices;
5 [StructLayout(LayoutKind.Explicit)]
6 struct DefaultPack
8 [FieldOffset(0)]
9 public int A;
10 [FieldOffset(4)]
11 public int A1;
12 [FieldOffset(8)]
13 public byte A2;
15 [FieldOffset(9)]
16 public int A3;
17 [FieldOffset(13)]
18 public int A4;
20 [StructLayout(LayoutKind.Explicit, Pack=2)]
21 struct ExplicitPack
23 [FieldOffset(0)]
24 public int A;
25 [FieldOffset(4)]
26 public int A1;
27 [FieldOffset(8)]
28 public byte A2;
30 [FieldOffset(9)]
31 public int A3;
32 [FieldOffset(13)]
33 public int A4;
36 [StructLayout(LayoutKind.Explicit, Size = 12)]
37 struct ExplicitSize
39 [FieldOffset(0)]
40 private long Data1;
42 [FieldOffset(8)]
43 private int Data3;
46 public class Program {
47 public static unsafe int Main(string[] args)
49 if (sizeof(DefaultPack) != 20)
50 return 1;
52 if (sizeof(ExplicitPack) != 18)
53 return 2;
55 if (sizeof (ExplicitSize) != 12)
56 return 3;
57 return 0;