Fix JIT crash with static function accessing non-static field
authorSejong Oh <sejooh@microsoft.com>
Wed, 6 Apr 2016 00:52:14 +0000 (17:52 -0700)
committerSejong Oh <sejooh@microsoft.com>
Mon, 11 Apr 2016 18:45:54 +0000 (11:45 -0700)
commit0e3eb21c2266abb55b1490f0231a2ad59bfc1aba
tree398e5492826b5fecc565711bba595a416ca5583f
parent4ee08c7f344a49e27dfece22cf0ff5159158e22b
Fix JIT crash with static function accessing non-static field

The IL below is invalid since the static function acceses the non-static
field. On Desktop CRL, JIT throws a verification exception. However, CoreCLR
doesn't support verification and JIT crashes. This fix makes JIT throw a
invalid program exception if verification is disabled.

.field int32 i
.method static int32 f()
{
ldsfld int32 Test::i
ret
}

The test also expects InvalidProgramException instead of
VerificationException.
src/jit/importer.cpp
tests/issues.targets
tests/src/JIT/Directed/coverage/importer/Desktop/badldsfld.il
tests/testsFailingOutsideWindows.txt