You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
JIT: (bug) crash (null deref in impFixPredLists) for finally { while (true) {} } when profile weights are used #135819
impFixPredLists dereferences Next() of every predecessor of a finally handler's first block without checking for BBJ_CALLFINALLY. For a finally with an infinite loop laid out as the last block, the only predecessor is its own back edge (Next() == nullptr), so the JIT crashes (AV) when compiling the method with profile weights (default tiering + dynamic PGO), even if the finally is never reached.
Default env (Checked JIT, main c6d6546). No crash with DOTNET_TieredCompilation=0 or DOTNET_TieredPGO=0; crashes with DOTNET_TC_QuickJitForLoops=0 and DOTNET_ReadyToRun=0. The method is first rejected for Tier0/OSR ("OSR can't handle loop in handler") and recompiled optimized with a synthesized profile.
Appears to be a regression from the .NET 10 cycle.
Notes
Compiler::impFixPredLists (importer.cpp): the first loop skips preds that aren't BBJ_CALLFINALLY, but the profile-weights fix-up loop doesn't: BasicBlock* const callFinallyRet = callFinally->Next(); callFinallyRet->setBBProfileWeight(...) (null deref).
Here the try ends in throw (no BBJ_CALLFINALLY) and the finally's first block has only itself as pred; it's the last block.
Fix: skip non-BBJ_CALLFINALLY preds in that loop. See also the related profile-inconsistency issue for finally entry back edges.
Activity
dotnet-policy-service commentedon Oct 14, 2026
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.
JIT: ignore finally-entry backedges when fixing continuation weights (d…