-// Compiler options: -unsafe \r
-using System;\r
-\r
-class C\r
-{\r
- static unsafe int Test ()\r
- {\r
- try {\r
- uint* i = stackalloc uint[int.MaxValue];\r
- uint v = 0;\r
- i [v] = v;\r
- i [0] = v;\r
- return 1;\r
- } catch (OverflowException) {\r
- return 0;\r
- }\r
- }\r
- \r
- unsafe static void Test2 ()\r
- {\r
- byte* b = null;\r
- b = b + (byte)1;\r
- b = b + (sbyte)1;\r
- b = b + (short)1;\r
- b = b + (int)1;\r
- b = b + (long)1;\r
- b = b + (ulong)1;\r
- }\r
- \r
- unsafe static void Test2 (sbyte sb, short s, int i, long l, ulong ul)\r
- {\r
- short* b = null;\r
- b = b + sb;\r
- b = b + s;\r
- b = b + i;\r
- b = b + l;\r
- b = b + ul;\r
- }\r
- \r
- public static int Main ()\r
- {\r
- Test2 ();\r
- Test2 (1, 2, 3, 4, 5);\r
- if (Test () != 0)\r
- return 1;\r
- \r
- Console.WriteLine ("OK");\r
- return 0;\r
- }\r
-}\r
+// Compiler options: -unsafe
+using System;
+
+class C
+{
+ static unsafe int Test ()
+ {
+ try {
+ uint* i = stackalloc uint[int.MaxValue];
+ uint v = 0;
+ i [v] = v;
+ i [0] = v;
+ return 1;
+ } catch (OverflowException) {
+ return 0;
+ }
+ }
+
+ unsafe static void Test2 ()
+ {
+ byte* b = null;
+ b = b + (byte)1;
+ b = b + (sbyte)1;
+ b = b + (short)1;
+ b = b + (int)1;
+ b = b + (long)1;
+ b = b + (ulong)1;
+ }
+
+ unsafe static void Test2 (sbyte sb, short s, int i, long l, ulong ul)
+ {
+ short* b = null;
+ b = b + sb;
+ b = b + s;
+ b = b + i;
+ b = b + l;
+ b = b + ul;
+ }
+
+ public static int Main ()
+ {
+ Test2 ();
+ Test2 (1, 2, 3, 4, 5);
+ if (Test () != 0)
+ return 1;
+
+ Console.WriteLine ("OK");
+ return 0;
+ }
+}