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.
Commit migrated from https://github.com/dotnet/coreclr/commit/
0e3eb21c2266abb55b1490f0231a2ad59bfc1aba