aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAndrew Stubbs <ams@codesourcery.com>2021-02-26 11:40:06 +0000
committerKwok Cheung Yeung <kcy@codesourcery.com>2022-06-21 14:11:33 +0100
commit87af8c58d3141bc62180770060f98a2a3583bb48 (patch)
tree1b104925b03893e5d80fda22aeb903ff1056ea04 /gcc
parent6ab6303f61c812d6e2f05d44af5cc79815c57bb8 (diff)
downloadgcc-87af8c58d3141bc62180770060f98a2a3583bb48.zip
gcc-87af8c58d3141bc62180770060f98a2a3583bb48.tar.gz
gcc-87af8c58d3141bc62180770060f98a2a3583bb48.tar.bz2
DWARF: fix ICE caused by offload debug fix
This should be squashed with 808bdf1bb29 and fdcb23540a2 to go to mainline. gcc/ * dwarf2out.cc (gen_subprogram_die): Replace existing low/high PC attributes, rather than ICE.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog.omp5
-rw-r--r--gcc/dwarf2out.cc18
2 files changed, 20 insertions, 3 deletions
diff --git a/gcc/ChangeLog.omp b/gcc/ChangeLog.omp
index b246293..1052b36 100644
--- a/gcc/ChangeLog.omp
+++ b/gcc/ChangeLog.omp
@@ -1,3 +1,8 @@
+2021-02-26 Andrew Stubbs <ams@codesourcery.com>
+
+ * dwarf2out.cc (gen_subprogram_die): Replace existing low/high PC
+ attributes, rather than ICE.
+
2021-02-02 Chung-Lin Tang <cltang@codesourcery.com>
* omp-offload.cc (omp_finish_file): Add code to create OpenMP requires
diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc
index 46e22c7..f66b25b 100644
--- a/gcc/dwarf2out.cc
+++ b/gcc/dwarf2out.cc
@@ -23761,9 +23761,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