https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63995
--- Comment #7 from Ilya Enkovich <enkovich.gnu at gmail dot com> --- In chkpopt pass calls to bndmk are moved down to uses to decrease register pressure. Debug info introduces new uses and therefore it affects a position where bndmk calls appear. -g0 case: <bb 4>: r.field = -1; __bound_tmp.1_13 = __builtin_ia32_bndmk (&r, 4); test2.chkp (&r, __bound_tmp.1_13); -g case: <bb 4>: # DEBUG c => &r __bound_tmp.1_13 = __builtin_ia32_bndmk (&r, 4); # DEBUG __chkp_bounds_of_c => NULL r.field = -1; test2.chkp (&r, __bound_tmp.1_13); Will ignore debug statements when computing a new position for bounds load/creation (BTW debug statement seems to be damaged by gsi_move_before called for bndmk). Testing following fix: diff --git a/gcc/tree-chkp-opt.c b/gcc/tree-chkp-opt.c index ff390d7..b8d5d0b 100644 --- a/gcc/tree-chkp-opt.c +++ b/gcc/tree-chkp-opt.c @@ -1175,7 +1175,9 @@ chkp_reduce_bounds_lifetime (void) FOR_EACH_IMM_USE_STMT (use_stmt, use_iter, op) { - if (dom_bb && + if (is_gimple_debug (use_stmt)) + continue; + else if (dom_bb && dominated_by_p (CDI_DOMINATORS, dom_bb, gimple_bb (use_stmt))) {