Merge pull request #3716 from vargaz/unbox-stobj-null
[mono.git] / mono / mini / method-to-ir.c
index be20f3e03397d9063e27406e77085ef5a05c8ea7..ad00295b8d291f8c9d4a7d1f60cd8e34fa15b088 100644 (file)
@@ -8479,7 +8479,8 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
 
        /* we use a separate basic block for the initialization code */
        NEW_BBLOCK (cfg, init_localsbb);
-       cfg->bb_init = init_localsbb;
+       if (cfg->method == method)
+               cfg->bb_init = init_localsbb;
        init_localsbb->real_offset = cfg->real_offset;
        start_bblock->next_bb = init_localsbb;
        init_localsbb->next_bb = cfg->cbb;
@@ -13690,7 +13691,10 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
        if (cfg->method == method) {
                MonoBasicBlock *bb;
                for (bb = cfg->bb_entry; bb; bb = bb->next_bb) {
-                       bb->region = mono_find_block_region (cfg, bb->real_offset);
+                       if (bb == cfg->bb_init)
+                               bb->region = -1;
+                       else
+                               bb->region = mono_find_block_region (cfg, bb->real_offset);
                        if (cfg->spvars)
                                mono_create_spvar_for_region (cfg, bb->region);
                        if (cfg->verbose_level > 2)