diff --git a/tests/arm/Tests.lst b/tests/arm/Tests.lst index 9e96a1eb994d..db556779e9dc 100644 --- a/tests/arm/Tests.lst +++ b/tests/arm/Tests.lst @@ -94740,3 +94740,67 @@ MaxAllowedDurationSeconds=600 Categories=EXPECTED_PASS HostStyle=0 +[GitHub_18522.cmd_11903] +RelativePath=JIT\Regression\JitBlue\GitHub_18522\GitHub_18522\GitHub_18522.cmd +WorkingDir=JIT\Regression\JitBlue\GitHub_18522\GitHub_18522 +Expected=0 +MaxAllowedDurationSeconds=600 +Categories=EXPECTED_PASS +HostStyle=0 + +[GitHub_18522_1.cmd_11904] +RelativePath=JIT\Regression\JitBlue\GitHub_18522\GitHub_18522_1\GitHub_18522_1.cmd +WorkingDir=JIT\Regression\JitBlue\GitHub_18522\GitHub_18522_1 +Expected=0 +MaxAllowedDurationSeconds=600 +Categories=EXPECTED_PASS +HostStyle=0 + +[GitHub_18522_2.cmd_11905] +RelativePath=JIT\Regression\JitBlue\GitHub_18522\GitHub_18522_2\GitHub_18522_2.cmd +WorkingDir=JIT\Regression\JitBlue\GitHub_18522\GitHub_18522_2 +Expected=0 +MaxAllowedDurationSeconds=600 +Categories=EXPECTED_PASS +HostStyle=0 + +[GitHub_18522_3.cmd_11906] +RelativePath=JIT\Regression\JitBlue\GitHub_18522\GitHub_18522_3\GitHub_18522_3.cmd +WorkingDir=JIT\Regression\JitBlue\GitHub_18522\GitHub_18522_3 +Expected=0 +MaxAllowedDurationSeconds=600 +Categories=EXPECTED_PASS +HostStyle=0 + +[GitHub_18522_4.cmd_11907] +RelativePath=JIT\Regression\JitBlue\GitHub_18522\GitHub_18522_4\GitHub_18522_4.cmd +WorkingDir=JIT\Regression\JitBlue\GitHub_18522\GitHub_18522_4 +Expected=0 +MaxAllowedDurationSeconds=600 +Categories=EXPECTED_PASS +HostStyle=0 + +[GitHub_18522_5.cmd_11908] +RelativePath=JIT\Regression\JitBlue\GitHub_18522\GitHub_18522_5\GitHub_18522_5.cmd +WorkingDir=JIT\Regression\JitBlue\GitHub_18522\GitHub_18522_5 +Expected=0 +MaxAllowedDurationSeconds=600 +Categories=EXPECTED_PASS +HostStyle=0 + +[GitHub_18522_6.cmd_11909] +RelativePath=JIT\Regression\JitBlue\GitHub_18522\GitHub_18522_6\GitHub_18522_6.cmd +WorkingDir=JIT\Regression\JitBlue\GitHub_18522\GitHub_18522_6 +Expected=0 +MaxAllowedDurationSeconds=600 +Categories=EXPECTED_PASS +HostStyle=0 + +[GitHub_18522_7.cmd_11910] +RelativePath=JIT\Regression\JitBlue\GitHub_18522\GitHub_18522_7\GitHub_18522_7.cmd +WorkingDir=JIT\Regression\JitBlue\GitHub_18522\GitHub_18522_7 +Expected=0 +MaxAllowedDurationSeconds=600 +Categories=EXPECTED_PASS +HostStyle=0 + diff --git a/tests/arm64/Tests.lst b/tests/arm64/Tests.lst index a9a732053a00..4d7592873474 100644 --- a/tests/arm64/Tests.lst +++ b/tests/arm64/Tests.lst @@ -94763,3 +94763,67 @@ Expected=0 MaxAllowedDurationSeconds=600 Categories=EXPECTED_PASS HostStyle=0 + +[GitHub_18522.cmd_12223] +RelativePath=JIT\Regression\JitBlue\GitHub_18522\GitHub_18522\GitHub_18522.cmd +WorkingDir=JIT\Regression\JitBlue\GitHub_18522\GitHub_18522 +Expected=0 +MaxAllowedDurationSeconds=600 +Categories=EXPECTED_PASS +HostStyle=0 + +[GitHub_18522_1.cmd_12224] +RelativePath=JIT\Regression\JitBlue\GitHub_18522\GitHub_18522_1\GitHub_18522_1.cmd +WorkingDir=JIT\Regression\JitBlue\GitHub_18522\GitHub_18522_1 +Expected=0 +MaxAllowedDurationSeconds=600 +Categories=EXPECTED_PASS +HostStyle=0 + +[GitHub_18522_2.cmd_12225] +RelativePath=JIT\Regression\JitBlue\GitHub_18522\GitHub_18522_2\GitHub_18522_2.cmd +WorkingDir=JIT\Regression\JitBlue\GitHub_18522\GitHub_18522_2 +Expected=0 +MaxAllowedDurationSeconds=600 +Categories=EXPECTED_PASS +HostStyle=0 + +[GitHub_18522_3.cmd_12226] +RelativePath=JIT\Regression\JitBlue\GitHub_18522\GitHub_18522_3\GitHub_18522_3.cmd +WorkingDir=JIT\Regression\JitBlue\GitHub_18522\GitHub_18522_3 +Expected=0 +MaxAllowedDurationSeconds=600 +Categories=EXPECTED_PASS +HostStyle=0 + +[GitHub_18522_4.cmd_12227] +RelativePath=JIT\Regression\JitBlue\GitHub_18522\GitHub_18522_4\GitHub_18522_4.cmd +WorkingDir=JIT\Regression\JitBlue\GitHub_18522\GitHub_18522_4 +Expected=0 +MaxAllowedDurationSeconds=600 +Categories=EXPECTED_PASS +HostStyle=0 + +[GitHub_18522_5.cmd_12228] +RelativePath=JIT\Regression\JitBlue\GitHub_18522\GitHub_18522_5\GitHub_18522_5.cmd +WorkingDir=JIT\Regression\JitBlue\GitHub_18522\GitHub_18522_5 +Expected=0 +MaxAllowedDurationSeconds=600 +Categories=EXPECTED_PASS +HostStyle=0 + +[GitHub_18522_6.cmd_12229] +RelativePath=JIT\Regression\JitBlue\GitHub_18522\GitHub_18522_6\GitHub_18522_6.cmd +WorkingDir=JIT\Regression\JitBlue\GitHub_18522\GitHub_18522_6 +Expected=0 +MaxAllowedDurationSeconds=600 +Categories=EXPECTED_PASS +HostStyle=0 + +[GitHub_18522_7.cmd_12230] +RelativePath=JIT\Regression\JitBlue\GitHub_18522\GitHub_18522_7\GitHub_18522_7.cmd +WorkingDir=JIT\Regression\JitBlue\GitHub_18522\GitHub_18522_7 +Expected=0 +MaxAllowedDurationSeconds=600 +Categories=EXPECTED_PASS +HostStyle=0 diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522.cs b/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522.cs new file mode 100644 index 000000000000..8cbcc6e5b8b1 --- /dev/null +++ b/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522.cs @@ -0,0 +1,39 @@ +// 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; + +// Based on a program generated by Fuzzlyn + +struct S0 +{ + public ushort F0; +} + +struct S1 +{ + public S0 F0; + public ushort F1; +} + +public class GitHub_18522 +{ + static S1 s_36; + + // When generating code for the x64 SysV ABI, the jit was + // incorrectly typing the return type from M113, and so + // inadvertently overwriting the F1 field of s_36 on return from + // the (inlined) call. + public static int Main() + { + s_36.F1 = 0xAA; + s_36.F0 = M113(); + return (s_36.F1 == 0xAA ? 100 : 0); + } + + static S0 M113() + { + return new S0(); + } +} diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522.csproj b/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522.csproj new file mode 100644 index 000000000000..95aba995a255 --- /dev/null +++ b/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522.csproj @@ -0,0 +1,34 @@ + + + + + Debug + AnyCPU + $(MSBuildProjectName) + 2.0 + {95DFC527-4DC1-495E-97D7-E94EE1F7140D} + Exe + {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + ..\..\ + + + + + + + False + + + + + True + + + + + + + + + + diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522_1.cs b/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522_1.cs new file mode 100644 index 000000000000..a5726451fb6c --- /dev/null +++ b/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522_1.cs @@ -0,0 +1,52 @@ +// 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; + +// Based on +// Original generated by Fuzzlyn on 2018-06-20 00:58:58 +// Seed: 11049252875418439527 +// Reduced from 97.5 KiB to 0.5 KiB +// Debug: Outputs -1 +// Release: Outputs -65536 + +struct S0 +{ + public sbyte F0; + public char F1; + public ushort F2; +} + +struct S1 +{ + public short F0; + public S0 F1; + public S0 F2; + public S0 F3; + public int F4; + public S1(int f4): this() + { + F4 = f4; + } +} + +public class GitHub_18522_1 +{ + static S1 s_6; + static S1[] s_13 = new S1[]{new S1(-1)}; + public static int Main() + { + // When generating code for the x64 SysV ABI, the jit was + // incorrectly typing the return type from M16, and so + // inadvertently overwriting the F4 field of s_13[0] on return + // from the (inlined) call. + s_13[0].F3 = M16(); + return s_13[0].F4 == -1 ? 100 : 0; + } + + static S0 M16() + { + return s_6.F3; + } +} diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522_1.csproj b/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522_1.csproj new file mode 100644 index 000000000000..95aba995a255 --- /dev/null +++ b/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522_1.csproj @@ -0,0 +1,34 @@ + + + + + Debug + AnyCPU + $(MSBuildProjectName) + 2.0 + {95DFC527-4DC1-495E-97D7-E94EE1F7140D} + Exe + {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + ..\..\ + + + + + + + False + + + + + True + + + + + + + + + + diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522_2.cs b/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522_2.cs new file mode 100644 index 000000000000..ab4090d0d369 --- /dev/null +++ b/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522_2.cs @@ -0,0 +1,54 @@ +// 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; + +// Based on +// Original generated by Fuzzlyn on 2018-06-20 00:58:58 +// Seed: 11049252875418439527 +// Reduced from 97.5 KiB to 0.5 KiB +// Debug: Outputs -1 +// Release: Outputs -65536 + +struct S0 +{ + public sbyte F0; + public char F1; + public ushort F2; +} + +struct S1 +{ + public short F0; + public S0 F1; + public S0 F2; + public S0 F3; + public int F4; + public S1(int f4): this() + { + F4 = f4; + } +} + +public class GitHub_18522_2 +{ + static S1 s_6; + static S1[] s_13 = new S1[]{new S1(-1)}; + public static int Main() + { + // When generating code for the x64 SysV ABI, the jit was + // incorrectly typing the return type from M16, and so + // inadvertently overwriting the F4 field of s_13[0] on return + // from the (not inlined) call. + s_13[0].F3 = M16(); + return s_13[0].F4 == -1 ? 100 : 0; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + static S0 M16() + { + return s_6.F3; + } +} diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522_2.csproj b/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522_2.csproj new file mode 100644 index 000000000000..95aba995a255 --- /dev/null +++ b/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522_2.csproj @@ -0,0 +1,34 @@ + + + + + Debug + AnyCPU + $(MSBuildProjectName) + 2.0 + {95DFC527-4DC1-495E-97D7-E94EE1F7140D} + Exe + {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + ..\..\ + + + + + + + False + + + + + True + + + + + + + + + + diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522_3.cs b/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522_3.cs new file mode 100644 index 000000000000..9d6960cfcb76 --- /dev/null +++ b/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522_3.cs @@ -0,0 +1,66 @@ +// 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; + +// Based on +// Original generated by Fuzzlyn on 2018-06-20 00:58:58 +// Seed: 11049252875418439527 +// Reduced from 97.5 KiB to 0.5 KiB +// Debug: Outputs -1 +// Release: Outputs -65536 + +struct S0 +{ + public sbyte F0; + public char F1; + public ushort F2; +} + +struct S1 +{ + public short F0; + public S0 F1; + public S0 F2; + public S0 F3; + public int F4; + public S1(int f4): this() + { + F4 = f4; + } +} + +public class GitHub_18522_3 +{ + static S1 s_6; + static S1[] s_13 = new S1[]{new S1(-1)}; + public static int Main() + { + // When generating code for the x64 SysV ABI, the jit was + // incorrectly typing the return type from M16, and so + // inadvertently overwriting the F4 field of s_13[0] on return + // from the call (which was an inline candidate, but not inlined). + s_13[0].F3 = M16(); + return s_13[0].F4 == -1 ? 100 : 0; + } + + static S0 M16() + { + // This bit of code is intended to allow M16 to be an + // inline candidate that ultimately does not get inlined. + short x = 0; + for (int i = 0; i < 10; i++) + { + for (int j = 0; j < 10; j++) + { + x++; + } + } + s_6.F0 = x; + + // Actual interesting part + return s_6.F3; + } +} diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522_3.csproj b/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522_3.csproj new file mode 100644 index 000000000000..95aba995a255 --- /dev/null +++ b/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522_3.csproj @@ -0,0 +1,34 @@ + + + + + Debug + AnyCPU + $(MSBuildProjectName) + 2.0 + {95DFC527-4DC1-495E-97D7-E94EE1F7140D} + Exe + {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + ..\..\ + + + + + + + False + + + + + True + + + + + + + + + + diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522_4.cs b/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522_4.cs new file mode 100644 index 000000000000..b6f54dc61507 --- /dev/null +++ b/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522_4.cs @@ -0,0 +1,62 @@ +// 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; + +// Based on +// Original generated by Fuzzlyn on 2018-06-20 00:58:58 +// Seed: 11049252875418439527 +// Reduced from 97.5 KiB to 0.5 KiB +// Debug: Outputs -1 +// Release: Outputs -65536 + +struct S0 +{ + public sbyte F0; + public char F1; + public ushort F2; +} + +struct S1 +{ + public short F0; + public S0 F1; + public S0 F2; + public S0 F3; + public int F4; + public S1(int f4): this() + { + F4 = f4; + } +} + +public class GitHub_18522_4 +{ + static S1 s_6; + static S1[] s_13 = new S1[]{new S1(-1)}; + public static int Main() + { + // When generating code for the x64 SysV ABI, the jit was + // incorrectly typing the return type from M16, and so + // inadvertently overwriting the F4 field of s_13[0] on return + // from the call. + // + // Here we make sure we properly handle an inline call that + // resolves to a noinline call. + s_13[0].F3 = W(); + return s_13[0].F4 == -1 ? 100 : 0; + } + + static S0 W() + { + return M16(); + } + + [MethodImpl(MethodImplOptions.NoInlining)] + static S0 M16() + { + return s_6.F3; + } +} diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522_4.csproj b/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522_4.csproj new file mode 100644 index 000000000000..95aba995a255 --- /dev/null +++ b/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522_4.csproj @@ -0,0 +1,34 @@ + + + + + Debug + AnyCPU + $(MSBuildProjectName) + 2.0 + {95DFC527-4DC1-495E-97D7-E94EE1F7140D} + Exe + {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + ..\..\ + + + + + + + False + + + + + True + + + + + + + + + + diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522_5.cs b/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522_5.cs new file mode 100644 index 000000000000..fdb2a72dc9ca --- /dev/null +++ b/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522_5.cs @@ -0,0 +1,74 @@ +// 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; + +// Based on +// Original generated by Fuzzlyn on 2018-06-20 00:58:58 +// Seed: 11049252875418439527 +// Reduced from 97.5 KiB to 0.5 KiB +// Debug: Outputs -1 +// Release: Outputs -65536 + +struct S0 +{ + public sbyte F0; + public char F1; + public ushort F2; +} + +struct S1 +{ + public short F0; + public S0 F1; + public S0 F2; + public S0 F3; + public int F4; + public S1(int f4): this() + { + F4 = f4; + } +} + +public class GitHub_18522_5 +{ + static S1 s_6; + static S1[] s_13 = new S1[]{new S1(-1)}; + public static int Main() + { + // When generating code for the x64 SysV ABI, the jit was + // incorrectly typing the return type from M16, and so + // inadvertently overwriting the F4 field of s_13[0] on return + // from the call. + // + // Here we make sure we properly handle an inlined call that + // resolves to a rejected inline candidate. + s_13[0].F3 = W(); + return s_13[0].F4 == -1 ? 100 : 0; + } + + static S0 W() + { + return M16(); + } + + static S0 M16() + { + // This bit of code is intended to allow M16 to be an + // inline candidate that ultimately does not get inlined. + short x = 0; + for (int i = 0; i < 10; i++) + { + for (int j = 0; j < 10; j++) + { + x++; + } + } + s_6.F0 = x; + + // Actual interesting part + return s_6.F3; + } +} diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522_5.csproj b/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522_5.csproj new file mode 100644 index 000000000000..95aba995a255 --- /dev/null +++ b/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522_5.csproj @@ -0,0 +1,34 @@ + + + + + Debug + AnyCPU + $(MSBuildProjectName) + 2.0 + {95DFC527-4DC1-495E-97D7-E94EE1F7140D} + Exe + {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + ..\..\ + + + + + + + False + + + + + True + + + + + + + + + + diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522_6.cs b/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522_6.cs new file mode 100644 index 000000000000..5a3990f509ae --- /dev/null +++ b/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522_6.cs @@ -0,0 +1,61 @@ +// 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; + +// Based on +// Original generated by Fuzzlyn on 2018-06-20 00:58:58 +// Seed: 11049252875418439527 +// Reduced from 97.5 KiB to 0.5 KiB +// Debug: Outputs -1 +// Release: Outputs -65536 + +struct S0 +{ + public sbyte F0; + public char F1; + public ushort F2; +} + +struct S1 +{ + public short F0; + public S0 F1; + public S0 F2; + public S0 F3; + public int F4; + public S1(int f4): this() + { + F4 = f4; + } +} + +public class GitHub_18522_6 +{ + static S1 s_6; + static S1[] s_13 = new S1[]{new S1(-1)}; + public static int Main() + { + // When generating code for the x64 SysV ABI, the jit was + // incorrectly typing the return type from M16, and so + // inadvertently overwriting the F4 field of s_13[0] on return + // from the call. + // + // Here we make sure we properly handle an inlined call that + // resolves to another inlined call. + s_13[0].F3 = W(); + return s_13[0].F4 == -1 ? 100 : 0; + } + + static S0 W() + { + return M16(); + } + + static S0 M16() + { + return s_6.F3; + } +} diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522_6.csproj b/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522_6.csproj new file mode 100644 index 000000000000..95aba995a255 --- /dev/null +++ b/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522_6.csproj @@ -0,0 +1,34 @@ + + + + + Debug + AnyCPU + $(MSBuildProjectName) + 2.0 + {95DFC527-4DC1-495E-97D7-E94EE1F7140D} + Exe + {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + ..\..\ + + + + + + + False + + + + + True + + + + + + + + + + diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522_7.cs b/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522_7.cs new file mode 100644 index 000000000000..e59d3ded8b19 --- /dev/null +++ b/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522_7.cs @@ -0,0 +1,67 @@ +// 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; + +// Based on +// Original generated by Fuzzlyn on 2018-06-20 00:58:58 +// Seed: 11049252875418439527 +// Reduced from 97.5 KiB to 0.5 KiB +// Debug: Outputs -1 +// Release: Outputs -65536 + +// Similar to other variants but using a 3 byte struct instead of 6. + +struct S0 +{ + public byte F0; + public byte F1; + public byte F2; +} + +struct S1 +{ + public S0 F3; + public sbyte F4; + public short F0; + public S1(sbyte f4): this() + { + F4 = f4; + } +} + +public class GitHub_18522_7 +{ + static S1 s_6; + static S1[] s_13 = new S1[]{new S1(-1)}; + public static int Main() + { + // When generating code for the x64 SysV ABI, the jit was + // incorrectly typing the return type from M16, and so + // inadvertently overwriting the F4 field of s_13[0] on return + // from the call. + // + // Here we make sure we properly handle the failed inline case. + s_13[0].F3 = M16(); + return s_13[0].F4 == -1 ? 100 : 0; + } + + static S0 M16() + { + // This bit of code is intended to allow M16 to be an + // inline candidate that ultimately does not get inlined. + short x = 0; + for (int i = 0; i < 10; i++) + { + for (int j = 0; j < 10; j++) + { + x++; + } + } + s_6.F0 = x; + + return s_6.F3; + } +} diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522_7.csproj b/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522_7.csproj new file mode 100644 index 000000000000..95aba995a255 --- /dev/null +++ b/tests/src/JIT/Regression/JitBlue/GitHub_18522/GitHub_18522_7.csproj @@ -0,0 +1,34 @@ + + + + + Debug + AnyCPU + $(MSBuildProjectName) + 2.0 + {95DFC527-4DC1-495E-97D7-E94EE1F7140D} + Exe + {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + ..\..\ + + + + + + + False + + + + + True + + + + + + + + + +