summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/jit/flowgraph.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/jit/flowgraph.cpp b/src/jit/flowgraph.cpp
index 2df3cce3ba..eedb1aa58f 100644
--- a/src/jit/flowgraph.cpp
+++ b/src/jit/flowgraph.cpp
@@ -6835,8 +6835,14 @@ void Compiler::fgImport()
// Assume if we generate any IR for the block we generate IR for the entire block.
if (!block->isEmpty())
{
- unsigned blockILSize = blockILSize = block->bbCodeOffsEnd - block->bbCodeOffs;
- importedILSize += blockILSize;
+ IL_OFFSET beginOffset = block->bbCodeOffs;
+ IL_OFFSET endOffset = block->bbCodeOffsEnd;
+
+ if ((beginOffset != BAD_IL_OFFSET) && (endOffset != BAD_IL_OFFSET) && (endOffset > beginOffset))
+ {
+ unsigned blockILSize = endOffset - beginOffset;
+ importedILSize += blockILSize;
+ }
}
}
}