summaryrefslogtreecommitdiff
path: root/tests/src/JIT/Regression/Dev11/Dev11_5437/Dev11_5437.cs
blob: ace6dbe22c1c50f22e75b6b87ece8302115b2bb5 (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
// 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.
//

using System;

class Program
{
    static void f(int c, int d, int e)
    {
        Console.WriteLine("c={0}, d={1}, e={2}", c, d, e);
        if (c + d != 4)
        {
            Console.WriteLine("FAILED: c + d != 4"); //We are hitting the bug so bailing out
            throw new Exception("FAILED");
        }
    }
    static int Main()
    {
        int d = 0;
        int i = 3;
        for (int e = 0; e < 2; e++)
        {
            while (true)
            {
                int c = 3 - d++;
                f(c, d, e); //  c == 3-d+1 !
                if (--i < 1) break;
            }
        }
        Console.WriteLine("PASSED");
        return 100; //Didn't hit the bug so return success
    }
}