From: Pat Gavlin Date: Wed, 1 Mar 2017 04:51:07 +0000 (-0800) Subject: Guard a use of a possibly-uninitialized BitSet. X-Git-Tag: submit/tizen/20210909.063632~11030^2~7896^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1549cd8ca264030e18331d6f2040dc1696b800e9;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Guard a use of a possibly-uninitialized BitSet. Part of the range check optimization pass was not checking to ensure that a bitset was initialized before attempting to access it. This was causing one of the new tests for Vector.Narrow to fail with an AV. Commit migrated from https://github.com/dotnet/coreclr/commit/06cdb2191857b6fab899b8ae1150604447e064ad --- diff --git a/src/coreclr/src/jit/rangecheck.cpp b/src/coreclr/src/jit/rangecheck.cpp index 8d16cce..22b5328 100644 --- a/src/coreclr/src/jit/rangecheck.cpp +++ b/src/coreclr/src/jit/rangecheck.cpp @@ -869,10 +869,13 @@ Range RangeCheck::ComputeRangeForLocalDef( case GT_ASG: { Range range = GetRange(loc->block, loc->stmt, asg->gtGetOp2(), path, monotonic DEBUGARG(indent)); - JITDUMP("Merge assertions from BB%02d:%s for assignment about %p\n", block->bbNum, - BitVecOps::ToString(m_pCompiler->apTraits, block->bbAssertionIn), dspPtr(asg->gtGetOp1())); - MergeEdgeAssertions(asg->gtGetOp1(), block->bbAssertionIn, &range); - JITDUMP("done merging\n"); + if (!BitVecOps::MayBeUninit(block->bbAssertionIn)) + { + JITDUMP("Merge assertions from BB%02d:%s for assignment about %p\n", block->bbNum, + BitVecOps::ToString(m_pCompiler->apTraits, block->bbAssertionIn), dspPtr(asg->gtGetOp1())); + MergeEdgeAssertions(asg->gtGetOp1(), block->bbAssertionIn, &range); + JITDUMP("done merging\n"); + } return range; }