]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
DWARF: fix ICE caused by offload debug fix
authorAndrew Stubbs <ams@codesourcery.com>
Fri, 26 Feb 2021 11:40:06 +0000 (11:40 +0000)
committerKwok Cheung Yeung <kcy@codesourcery.com>
Thu, 22 Apr 2021 17:14:32 +0000 (10:14 -0700)
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.

gcc/dwarf2out.c

index 81e1c361b993793d21221dc0138c471694abad5a..5275d380990b001dec5edeb8cc646fb98a978f28 100644 (file)
@@ -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