Permalink
Browse files

Add a test for 7cb704d.

  • Loading branch information...
1 parent ced2c6c commit ec866fff45289124e725c59675b85f38608150f8 @vargaz vargaz committed Jul 12, 2011
Showing with 63 additions and 0 deletions.
  1. +63 −0 mono/mini/exceptions.cs
View
@@ -2620,5 +2620,68 @@ unsafe struct Foo
return 0;
}
+
+ static int test_0_try_clause_in_finally_clause_regalloc () {
+ // Fill up registers with values
+ object a = new object ();
+ object[] arr1 = new object [1];
+ object[] arr2 = new object [1];
+ object[] arr3 = new object [1];
+ object[] arr4 = new object [1];
+ object[] arr5 = new object [1];
+
+ for (int i = 0; i < 10; ++i)
+ arr1 [0] = a;
+ for (int i = 0; i < 10; ++i)
+ arr2 [0] = a;
+ for (int i = 0; i < 10; ++i)
+ arr3 [0] = a;
+ for (int i = 0; i < 10; ++i)
+ arr4 [0] = a;
+ for (int i = 0; i < 10; ++i)
+ arr5 [0] = a;
+
+ int res = 1;
+ try {
+ try_clause_in_finally_clause_regalloc_inner (out res);
+ } catch (Exception) {
+ }
+ return res;
+ }
+
+ public static object Throw () {
+ for (int i = 0; i < 10; ++i)
+ ;
+ throw new Exception ();
+ }
+
+ static void try_clause_in_finally_clause_regalloc_inner (out int res) {
+ object o = null;
+
+ res = 1;
+ try {
+ o = Throw ();
+ } catch (Exception) {
+ /* Make sure this doesn't branch to the finally */
+ throw new DivideByZeroException ();
+ } finally {
+ try {
+ /* Make sure o is register allocated */
+ if (o == null)
+ res = 0;
+ else
+ res = 1;
+ if (o == null)
+ res = 0;
+ else
+ res = 1;
+ if (o == null)
+ res = 0;
+ else
+ res = 1;
+ } catch (DivideByZeroException) {
+ }
+ }
+ }
}

0 comments on commit ec866ff

Please sign in to comment.