summaryrefslogtreecommitdiff
path: root/tests/src/JIT/Regression/JitBlue/DevDiv_280127/DevDiv_280127.cs
blob: 3f8270f70c508619bf30c81a36e22a8cd92e7cd8 (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
// 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;
using System.Runtime.CompilerServices;

// The original repro for this test was an assertion after code generation that the actual maximum depth of the stack
// was less than or identical to the estimated depth of the stack as calculated during morph. The calculation was
// incorrect when a math intrinsic was used as an argument to a function with on-stack parameters (e.g. the call to
// `M` on line 18).

static class C
{
    struct S
    {
        int a, b, c, d;
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    static int N(S s, float d)
    {
        return 100;
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    static int M(double d)
    {
        N(new S(), (float)(Math.Atan2(d, 2.0) * 180 / Math.PI));
        return 100;
    }

    static int Main()
    {
        return M(2.0);
    }
}