diff options
author | Jiyoung Yun <jy910.yun@samsung.com> | 2016-12-27 16:46:08 +0900 |
---|---|---|
committer | Jiyoung Yun <jy910.yun@samsung.com> | 2016-12-27 16:46:08 +0900 |
commit | db20f3f1bb8595633a7e16c8900fd401a453a6b5 (patch) | |
tree | e5435159cd1bf0519276363a6fe1663d1721bed3 /tests/src/JIT/Regression/JitBlue/DevDiv_283795/DevDiv_283795.cs | |
parent | 4b4aad7217d3292650e77eec2cf4c198ea9c3b4b (diff) | |
download | coreclr-db20f3f1bb8595633a7e16c8900fd401a453a6b5.tar.gz coreclr-db20f3f1bb8595633a7e16c8900fd401a453a6b5.tar.bz2 coreclr-db20f3f1bb8595633a7e16c8900fd401a453a6b5.zip |
Imported Upstream version 1.0.0.9127upstream/1.0.0.9127
Diffstat (limited to 'tests/src/JIT/Regression/JitBlue/DevDiv_283795/DevDiv_283795.cs')
-rw-r--r-- | tests/src/JIT/Regression/JitBlue/DevDiv_283795/DevDiv_283795.cs | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/tests/src/JIT/Regression/JitBlue/DevDiv_283795/DevDiv_283795.cs b/tests/src/JIT/Regression/JitBlue/DevDiv_283795/DevDiv_283795.cs new file mode 100644 index 0000000000..55da5ba1e9 --- /dev/null +++ b/tests/src/JIT/Regression/JitBlue/DevDiv_283795/DevDiv_283795.cs @@ -0,0 +1,55 @@ +// 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.Runtime.CompilerServices; + +class C +{ + [MethodImpl(MethodImplOptions.AggressiveInlining)] + static int[] M() + { + return null; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + static bool Test(int i, int j, bool execute) + { + if (execute) + { + return M()[checked(i + j)] == 0; + } + + return true; + } + + static int Main() + { + // The original repro of the bug associated with this test involved an assert after re-morphing a tree modified + // by CSE: the original tree contained both a CSE def and a CSE use, and re-morphing eliminated the use, causing + // CSE to assert when attempting to replace the use with a reference to the CSE lclVar. This call to `Test` is + // intended to trigger that assert. + bool test1 = Test(0, 0, false); + + // The associated code in morph involves folding `(x + null)` to `x`. During the investigation of the original + // issue, it was found that the folding code also failed to check for side effects in `x` resulting in SBCG if + // side effects were in fact present in `x`. This call to `Test` is intended to ensure that the fold is not + // performed in the face of a tree that contains side-effects: in particular, the overflowing add in the + // called method should occur before any other exception. + bool test2 = false; + try + { + Test(int.MaxValue, int.MaxValue, true); + } + catch (System.OverflowException) + { + test2 = true; + } + catch (System.Exception e) + { + System.Console.WriteLine(e); + } + + return test1 && test2 ? 100 : 101; + } +} |