blob: a52c0a72b201a6cc31925ba03be6f36e9a6ecbda (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
// Compiler options: -unsafe
using System;
namespace MonoPointerBugTest
{
struct MyStructure
{
int q;
int z;
int a;
}
class Program
{
public static int Main ()
{
unsafe {
MyStructure structure = new MyStructure ();
MyStructure* pointer1 = &structure;
MyStructure* pointer2 = pointer1;
//on the Mac this works like: pointer2++;
pointer2 += 10;
int difference = (int) ((byte*) pointer2 - (byte*) pointer1);
if (difference != 120)
return 1;
return 0;
}
}
}
}
|