From 464b6c1117aa4b95cc4c7389cdb145461fc945be Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Sat, 13 Oct 2018 17:32:07 +0000 Subject: [PATCH] dwarf2cfi.c (struct dw_trace_info): Add args_size_defined_for_eh. * dwarf2cfi.c (struct dw_trace_info): Add args_size_defined_for_eh. (notice_args_size): Set it in the current trace if no insn that can throw internally has been seen yet. (connect_traces): When connecting args_size between traces, allow the incoming values not to match if there is an insn setting it before the first insn that can throw internally; in that case, force the creation of a CFI note on this latter insn. From-SVN: r265142 --- gcc/ChangeLog | 10 ++++++++++ gcc/dwarf2cfi.c | 16 ++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1f84d8776d0..49770e78a85 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2018-10-13 Eric Botcazou + + * dwarf2cfi.c (struct dw_trace_info): Add args_size_defined_for_eh. + (notice_args_size): Set it in the current trace if no insn that can + throw internally has been seen yet. + (connect_traces): When connecting args_size between traces, allow the + incoming values not to match if there is an insn setting it before the + first insn that can throw internally; in that case, force the creation + of a CFI note on this latter insn. + 2018-10-13 Jonathan Wakely * opt-problem.h (opt_wrapper): Use template-argument-list when naming diff --git a/gcc/dwarf2cfi.c b/gcc/dwarf2cfi.c index 4cfb91b8d40..162d9f64f18 100644 --- a/gcc/dwarf2cfi.c +++ b/gcc/dwarf2cfi.c @@ -147,6 +147,9 @@ struct dw_trace_info /* True if we've seen different values incoming to beg_true_args_size. */ bool args_size_undefined; + + /* True if we've seen an insn with a REG_ARGS_SIZE note before EH_HEAD. */ + bool args_size_defined_for_eh; }; @@ -942,6 +945,9 @@ notice_args_size (rtx_insn *insn) if (note == NULL) return; + if (!cur_trace->eh_head) + cur_trace->args_size_defined_for_eh = true; + args_size = get_args_size (note); delta = args_size - cur_trace->end_true_args_size; if (known_eq (delta, 0)) @@ -2820,11 +2826,17 @@ connect_traces (void) if (ti->switch_sections) prev_args_size = 0; + if (ti->eh_head == NULL) continue; - gcc_assert (!ti->args_size_undefined); - if (maybe_ne (ti->beg_delay_args_size, prev_args_size)) + /* We require either the incoming args_size values to match or the + presence of an insn setting it before the first EH insn. */ + gcc_assert (!ti->args_size_undefined || ti->args_size_defined_for_eh); + + /* In the latter case, we force the creation of a CFI note. */ + if (ti->args_size_undefined + || maybe_ne (ti->beg_delay_args_size, prev_args_size)) { /* ??? Search back to previous CFI note. */ add_cfi_insn = PREV_INSN (ti->eh_head); -- 2.30.2