[interp] fix for ldflda unsafe corner case
[mono.git] / mono / mini / exceptions.cs
index 131a9c63a5ce1b69d7cfe3ffb0f9450325c9817a..d13385e35bb09348a29b3760622749223b02fbba 100644 (file)
@@ -24,14 +24,14 @@ using System.Runtime.CompilerServices;
  * the IL code looks.
  */
 
-#if MOBILE
+#if __MOBILE__
 class ExceptionTests
 #else
 class Tests
 #endif
 {
 
-#if !MOBILE
+#if !__MOBILE__
        public static int Main (string[] args) {
                return TestDriver.RunTests (typeof (Tests), args);
        }
@@ -2230,6 +2230,7 @@ class Tests
                }
        }
 
+       [Category ("!INTERPRETER")]
        public static int test_0_exception_in_cctor () {
                try {
                        Broken.DoSomething ();
@@ -2318,6 +2319,8 @@ class Tests
                Console.WriteLine ();
        }
 
+       [Category ("!INTERPRETER")]
+       [Category ("!BITCODE")]
        public static int test_0_rethrow_stacktrace () {
                // Check that rethrowing an exception preserves the original stack trace
                try {
@@ -2589,7 +2592,7 @@ class Tests
        public static int test_0_lmf_filter () {
                try {
                        // The invoke calls a runtime-invoke wrapper which has a filter clause
-#if MOBILE
+#if __MOBILE__
                        typeof (ExceptionTests).GetMethod ("lmf_filter").Invoke (null, new object [] { });
 #else
                        typeof (Tests).GetMethod ("lmf_filter").Invoke (null, new object [] { });
@@ -2816,10 +2819,38 @@ class Tests
                }
                return finally_called ? 0 : 1;
        }
+
+       static int array_len_1 = 1;
+
+       public static int test_0_bounds_check_negative_constant () {
+               try {
+                       byte[] arr = new byte [array_len_1];
+                       byte b = arr [-1];
+                       return 1;
+               } catch {
+               }
+               try {
+                       byte[] arr = new byte [array_len_1];
+                       arr [-1] = 1;
+                       return 2;
+               } catch {
+               }
+               return 0;
+       }
+
+       public static int test_0_string_bounds_check_negative_constant () {
+               try {
+                       string s = "A";
+                       char c = s [-1];
+                       return 1;
+               } catch {
+               }
+               return 0;
+       }
 }
 
-#if !MOBILE
+#if !__MOBILE__
 class ExceptionTests : Tests
 {
 }
-#endif
\ No newline at end of file
+#endif