summaryrefslogtreecommitdiff
path: root/tests/src/JIT/jit64/opt/cprop/cprop001.cs
blob: 73fc56df27760e54fc69356936cc256c652f62e5 (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
// 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.

public class LIM
{
    public static int accumulator = 0;

    public static int Main()
    {
        int x;
        int a = GetInt(1);

        for (int i = 0; i < 5; i++)
        {
            x = a;
            Accumulate(x);
            x = GetInt(0);
            Accumulate(x);
        }

        if (accumulator == 5)
        {
            System.Console.WriteLine("Pass");
            return 100;
        }

        System.Console.WriteLine("!!!FAIL!!!");
        return -1;
    }



    public static int GetInt(int x)
    {
        try
        {
            return x;
        }
        catch
        {
            throw;
        }
    }


    public static void Accumulate(int x)
    {
        try
        {
            accumulator += x;
        }
        catch
        {
            throw;
        }
    }
}