Merge pull request #5439 from alexrp/master
[mono.git] / mcs / tests / test-793.cs
1 // Compiler options: -unsafe
2
3 using System;
4
5 namespace MonoPointerBugTest
6 {
7         struct MyStructure
8         {
9                 int q;
10                 int z;
11                 int a;
12         }
13
14         class Program
15         {
16                 public static int Main ()
17                 {
18                         unsafe {
19                                 MyStructure structure = new MyStructure ();
20
21                                 MyStructure* pointer1 = &structure;
22                                 MyStructure* pointer2 = pointer1;
23
24                                 //on the Mac this works like: pointer2++;
25                                 pointer2 += 10;
26
27                                 int difference = (int) ((byte*) pointer2 - (byte*) pointer1);
28                                 if (difference != 120)
29                                         return 1;
30
31                                 return 0;
32                         }
33                 }
34         }
35 }