From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1729) id BEAE13AA991A; Thu, 13 May 2021 16:19:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BEAE13AA991A Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Kwok Yeung To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/omp/gcc-11] DWARF: fix ICE caused by offload debug fix X-Act-Checkin: gcc X-Git-Author: Andrew Stubbs X-Git-Refname: refs/heads/devel/omp/gcc-11 X-Git-Oldrev: fb49713d797ee78b31b557a61a59a67724177a8d X-Git-Newrev: 5c7c1a8ad52aa82ea5e18d4ba6fb03431e65edcf Message-Id: <20210513161936.BEAE13AA991A@sourceware.org> Date: Thu, 13 May 2021 16:19:36 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 16:19:36 -0000 https://gcc.gnu.org/g:5c7c1a8ad52aa82ea5e18d4ba6fb03431e65edcf commit 5c7c1a8ad52aa82ea5e18d4ba6fb03431e65edcf Author: Andrew Stubbs Date: Fri Feb 26 11:40:06 2021 +0000 DWARF: fix ICE caused by offload debug fix This should be squashed with 808bdf1bb29 and fdcb23540a2 to go to mainline. gcc/ * dwarf2out.c (gen_subprogram_die): Replace existing low/high PC attributes, rather than ICE. Diff: --- gcc/dwarf2out.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 81e1c361b99..5275d380990 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -23417,9 +23417,21 @@ gen_subprogram_die (tree decl, dw_die_ref context_die) dw_fde_ref fde = fun->fde; if (fde->dw_fde_begin) { - /* We have already generated the labels. */ - add_AT_low_high_pc (subr_die, fde->dw_fde_begin, - fde->dw_fde_end, false); + dw_attr_node *low = get_AT (subr_die, DW_AT_low_pc); + dw_attr_node *high = get_AT (subr_die, DW_AT_high_pc); + if (low && high) + { + /* Replace the existing value, it will have come from + the "omp target entrypoint" case below. */ + free (low->dw_attr_val.v.val_lbl_id); + low->dw_attr_val.v.val_lbl_id = xstrdup (fde->dw_fde_begin); + free (high->dw_attr_val.v.val_lbl_id); + high->dw_attr_val.v.val_lbl_id = xstrdup (fde->dw_fde_end); + } + else + /* We have already generated the labels. */ + add_AT_low_high_pc (subr_die, fde->dw_fde_begin, + fde->dw_fde_end, false); /* Offload kernel functions are nested within a parent function that doesn't actually exist within the offload object. GDB