diff --git a/src/coreclr/jit/fgehopt.cpp b/src/coreclr/jit/fgehopt.cpp index dce67ac1cf2e27..54c0adcbdeb3ab 100644 --- a/src/coreclr/jit/fgehopt.cpp +++ b/src/coreclr/jit/fgehopt.cpp @@ -1037,9 +1037,13 @@ PhaseStatus Compiler::fgRemoveEmptyTryCatchOrTryFault() // fgRemoveEHTableEntry(XTnum); - // (6) The old try entry no longer needs special protection. + // (6) The old try entry may no longer need special protection. + // (it may still be an entry of an enclosing try) // - firstTryBlock->RemoveFlags(BBF_DONT_REMOVE); + if (!bbIsTryBeg(firstTryBlock)) + { + firstTryBlock->RemoveFlags(BBF_DONT_REMOVE); + } // Another one bites the dust... emptyCount++; diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_110958/Runtime_110985.cs b/src/tests/JIT/Regression/JitBlue/Runtime_110958/Runtime_110985.cs new file mode 100644 index 00000000000000..794b624e8194a0 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_110958/Runtime_110985.cs @@ -0,0 +1,80 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +// Found by Antigen +// Reduced from 17.57 KB to 2.06 KB. + +using System.Collections.Generic; +using System.Runtime.Intrinsics.Arm; +using Xunit; + +public class Runtime_110958 +{ + long long_30 = 5; + ulong ulong_36 = 0; + SveMaskPattern SveMaskPattern_37 = SveMaskPattern.VectorCount1; + private static List toPrint = new List(); + private void Method0() + { + unchecked + { + ulong ulong_77 = 2; + SveMaskPattern SveMaskPattern_78 = SveMaskPattern_37; + try + { + try + { + ulong_36 -= ulong_77; + } + catch (System.FieldAccessException) + { } + catch (System.ExecutionEngineException) + { } + } + catch (System.RankException) + { + } + catch (System.MemberAccessException) + { + do + { + try + { + switch ((15 << 4) * long_30) + { + case -1: + { + break; + } + default: + { + break; + } + } + } + catch (System.InvalidProgramException) + { + } + catch (System.InvalidCastException) + { + } + } + while (15 < 4); + } + catch (System.AggregateException) + { + } + finally + { + } + return; + } + } + + [Fact] + public static void Problem0() + { + new Runtime_110958().Method0(); + } +} + diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_110958/Runtime_110985.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_110958/Runtime_110985.csproj new file mode 100644 index 00000000000000..5ef196a0406c05 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_110958/Runtime_110985.csproj @@ -0,0 +1,14 @@ + + + True + + true + + + + + + + + +