[jit] Fix the saving of the 'cfg->ret_var_set' flag when inlining, it was set to...
[mono.git] / mcs / tests / test-653.cs
1 // Compiler options: -unsafe 
2 using System;
3
4 class C
5 {
6         static unsafe int Test ()
7         {
8                 try {
9                         uint* i = stackalloc uint[int.MaxValue];
10                         uint v = 0;
11                         i [v] = v;
12                         i [0] = v;
13                         return 1;
14                 } catch (OverflowException) {
15                         return 0;
16                 }
17         }
18         
19         unsafe static void Test2 ()
20         {
21                 byte* b = null;
22                 b = b + (byte)1;
23                 b = b + (sbyte)1;
24                 b = b + (short)1;
25                 b = b + (int)1;
26                 b = b + (long)1;
27                 b = b + (ulong)1;
28         }
29         
30         unsafe static void Test2 (sbyte sb, short s, int i, long l, ulong ul)
31         {
32                 short* b = null;
33                 b = b + sb;
34                 b = b + s;
35                 b = b + i;
36                 b = b + l;
37                 b = b + ul;
38         }
39         
40         public static int Main ()
41         {
42                 Test2 ();
43                 Test2 (1, 2, 3, 4, 5);
44                 if (Test () != 0)
45                         return 1;
46                         
47                 Console.WriteLine ("OK");
48                 return 0;
49         }
50 }