summaryrefslogtreecommitdiff
path: root/tests/src/JIT/Regression/CLR-x86-JIT/V1-M09.5-PDC/b28787/b28787.cs
blob: d5dd2e06321910d87c112984661e26674b0725cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
//

namespace Test
{
    using System;

    class AA
    {
        public bool m_bField1 = false;
        public static double m_dStatic2 = -127.46;

        public int Method1()
        {
            double[] local4 = new double[2];
            double local3 = 35.40;

            while (m_bField1)
                return 0;

            do
            {
                do
                {
                    if (local3 < 0.0)
                        GC.Collect();

                    m_dStatic2 = local4[2];		//fire IndexOutOfRangeException	

                } while (new AA().m_bField1);

                while (m_bField1) { }

            } while (new AA().m_bField1);

            do
            {
            } while (0.0 <= local4[100]);		//fire IndexOutOfRangeException	

            return 1;
        }

        static int Main()
        {
            try
            {
                Console.WriteLine("Testing AA::Method1");
                new AA().Method1();
            }
            catch (Exception)
            {
                Console.WriteLine("Exception handled.");
            }
            return 100;
        }
    }
}