diff options
author | Marek Safar <marek.safar@gmail.com> | 2008-07-03 15:31:43 +0400 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2008-07-03 15:31:43 +0400 |
commit | 77e89ee9723e983aaa599fc3705e19701c6f9506 (patch) | |
tree | 6931d0d47c9a9fbc985e33040e7f58f6622acbce /mcs/tests/test-653.cs | |
parent | 384ed8d5d3af338619315fa414ec5b6d5d89acc2 (diff) |
New test + optimizations update
svn path=/trunk/mcs/; revision=107141
Diffstat (limited to 'mcs/tests/test-653.cs')
-rwxr-xr-x | mcs/tests/test-653.cs | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/mcs/tests/test-653.cs b/mcs/tests/test-653.cs new file mode 100755 index 00000000000..1402d8881e6 --- /dev/null +++ b/mcs/tests/test-653.cs @@ -0,0 +1,50 @@ +// 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;
+ }
+}
|