https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83422
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- So, at minimum I think we need something like: --- gcc/var-tracking.c.jj 2017-12-14 12:02:07.000000000 +0100 +++ gcc/var-tracking.c 2017-12-14 12:31:22.802421765 +0100 @@ -10328,6 +10328,10 @@ delete_vta_debug_insns (void) else delete_insn (insn); } + else if (NOTE_P (insn) + && NOTE_KIND (insn) == NOTE_INSN_BEGIN_STMT + && !cfun->debug_nonbind_markers) + delete_insn (insn); } } @@ -10424,8 +10428,8 @@ variable_tracking_main_1 (void) if (!flag_var_tracking) return 0; - if (n_basic_blocks_for_fn (cfun) > 500 && - n_edges_for_fn (cfun) / n_basic_blocks_for_fn (cfun) >= 20) + if (n_basic_blocks_for_fn (cfun) > 500 + && n_edges_for_fn (cfun) / n_basic_blocks_for_fn (cfun) >= 20) { vt_debug_insns_local (true); return 0; But, I wonder why we ever clear cfun->debug_nonbind_markers in var-tracking.c. If the debug markers are useless without -fvariable-tracking-assignments, then I'm not sure why those aren't guarded by that too (and why we ever enable statemetn frontiers without -fvar-tracking-assignments). If they are useful even without -fvar-tracking-assignments, but we need a successful vt_find_locations + vt_emit_notes, then we should drop them only if that didn't pass (in case we run into the limits and fail -fvar-tracking-assignments vt_find_locations, we can still successfully vt_find_locations + vt_emit_notes without -fvar-tracking-assignments). Alex, please say what is the case here.