[gcc(refs/vendors/redhat/heads/gcc-8-branch)] debug/92763 keep DIEs that might be used in DW_TAG_inlined_subroutine
Jakub Jelinek
jakub@gcc.gnu.org
Thu Sep 17 16:43:20 GMT 2020
https://gcc.gnu.org/g:2c9144fa24b73884f16f77dce9f8d57f1d822e75
commit 2c9144fa24b73884f16f77dce9f8d57f1d822e75
Author: Richard Biener <rguenther@suse.de>
Date: Fri Feb 14 09:17:57 2020 +0100
debug/92763 keep DIEs that might be used in DW_TAG_inlined_subroutine
We were pruning type-local subroutine DIEs if their context is unused
despite us later needing those DIEs as abstract origins for inlines.
The patch makes code already present for -fvar-tracking-assignments
unconditional.
2020-02-14 Richard Biener <rguenther@suse.de>
Backport from mainline
2020-01-20 Richard Biener <rguenther@suse.de>
PR debug/92763
* dwarf2out.c (prune_unused_types): Unconditionally mark
called function DIEs.
* g++.dg/debug/pr92763.C: New testcase.
Diff:
---
gcc/ChangeLog | 9 +++++++++
gcc/dwarf2out.c | 9 ++++-----
gcc/testsuite/ChangeLog | 8 ++++++++
gcc/testsuite/g++.dg/debug/pr92763.C | 20 ++++++++++++++++++++
4 files changed, 41 insertions(+), 5 deletions(-)
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 07fa5d4d5e5..3353a526642 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2020-02-17 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2020-01-20 Richard Biener <rguenther@suse.de>
+
+ PR debug/92763
+ * dwarf2out.c (prune_unused_types): Unconditionally mark
+ called function DIEs.
+
2020-02-17 Richard Biener <rguenther@suse.de>
Backport from mainline
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index ab01f7dbcae..12e33c2dd93 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -29427,9 +29427,9 @@ prune_unused_types (void)
for (i = 0; base_types.iterate (i, &base_type); i++)
prune_unused_types_mark (base_type, 1);
- /* For -fvar-tracking-assignments, also set the mark on nodes that could be
- referenced by DW_TAG_call_site DW_AT_call_origin (i.e. direct call
- callees). */
+ /* Also set the mark on nodes that could be referenced by
+ DW_TAG_call_site DW_AT_call_origin (i.e. direct call callees) or
+ by DW_TAG_inlined_subroutine origins. */
cgraph_node *cnode;
FOR_EACH_FUNCTION (cnode)
if (cnode->referred_to_p (false))
@@ -29438,8 +29438,7 @@ prune_unused_types (void)
if (die == NULL || die->die_mark)
continue;
for (cgraph_edge *e = cnode->callers; e; e = e->next_caller)
- if (e->caller != cnode
- && opt_for_fn (e->caller->decl, flag_var_tracking_assignments))
+ if (e->caller != cnode)
{
prune_unused_types_mark (die, 1);
break;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index fefede25d39..0afcde16af9 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2020-02-17 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2020-01-20 Richard Biener <rguenther@suse.de>
+
+ PR debug/92763
+ * g++.dg/debug/pr92763.C: New testcase.
+
2020-02-17 Richard Biener <rguenther@suse.de>
Backport from mainline
diff --git a/gcc/testsuite/g++.dg/debug/pr92763.C b/gcc/testsuite/g++.dg/debug/pr92763.C
new file mode 100644
index 00000000000..16dccf3b56f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/debug/pr92763.C
@@ -0,0 +1,20 @@
+// { dg-do compile }
+// { dg-require-effective-target fopenmp }
+// { dg-additional-options "-fno-var-tracking-assignments -fopenmp" }
+
+struct A
+{
+ typedef int T;
+ #pragma omp declare reduction (y : T : [&omp_out, &omp_in]() { omp_out += omp_in; return 0; }()) initializer (omp_priv = [omp_orig]() { return omp_orig; }())
+ static void foo ();
+};
+
+void
+A::foo ()
+{
+ int r = 0, s = 0;
+ #pragma omp parallel for reduction (y : r, s)
+ for (int i = 0; i < 1; i++)
+ {
+ }
+}
More information about the Gcc-cvs
mailing list