return 1;
}
+
+ unsafe struct Foo
+ {
+ public int i;
+
+ public static Foo* pFoo;
+ }
+
+ /* MS.NET doesn't seem to throw in this case */
+ public unsafe static int test_0_ldflda_null_pointer () {
+ int* pi = &Foo.pFoo->i;
+
+ return 0;
+ }
}
}
if (*ip == CEE_LDFLDA) {
- MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, sp [0]->dreg, 0);
- MONO_EMIT_NEW_COND_EXC (cfg, EQ, "NullReferenceException");
+ if (sp [0]->type == STACK_OBJ) {
+ MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, sp [0]->dreg, 0);
+ MONO_EMIT_NEW_COND_EXC (cfg, EQ, "NullReferenceException");
+ }
dreg = alloc_preg (cfg);