diff --git a/src/jit/compiler.hpp b/src/jit/compiler.hpp index 2a6fd861536a..93db46bfef17 100644 --- a/src/jit/compiler.hpp +++ b/src/jit/compiler.hpp @@ -4355,7 +4355,13 @@ inline GenTree* Compiler::impCheckForNullPointer(GenTree* obj) if (obj->gtOper == GT_CNS_INT) { assert(obj->gtType == TYP_REF || obj->gtType == TYP_BYREF); - assert(obj->gtIntCon.gtIconVal == 0); + + // We can see non-zero byrefs for RVA statics. + if (obj->gtIntCon.gtIconVal != 0) + { + assert(obj->gtType == TYP_BYREF); + return obj; + } unsigned tmp = lvaGrabTemp(true DEBUGARG("CheckForNullPointer")); diff --git a/tests/src/JIT/Directed/RVAInit/oddsize.ilproj b/tests/src/JIT/Directed/RVAInit/oddsize.ilproj index 39d8bfaf0d96..7e22d9ffb4f8 100644 --- a/tests/src/JIT/Directed/RVAInit/oddsize.ilproj +++ b/tests/src/JIT/Directed/RVAInit/oddsize.ilproj @@ -10,7 +10,6 @@ Exe {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} ..\..\ - 1