debug/92763 keep DIEs that might be used in DW_TAG_inlined_subroutine
diff mbox series

Message ID nycvar.YFH.7.76.2001201203200.5566@zhemvz.fhfr.qr
State New
Headers show
Series
  • debug/92763 keep DIEs that might be used in DW_TAG_inlined_subroutine
Related show

Commit Message

Richard Biener Jan. 20, 2020, 11:04 a.m. UTC
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.

Bootstrapped and tested on x86_64-unknown-linux-gnu, OK?

Thanks,
Richard.

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.

Comments

Jakub Jelinek Jan. 20, 2020, 11:09 a.m. UTC | #1
On Mon, Jan 20, 2020 at 12:04:12PM +0100, Richard Biener wrote:
> 
> 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.
> 
> Bootstrapped and tested on x86_64-unknown-linux-gnu, OK?
> 
> Thanks,
> Richard.
> 
> 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.

Ok.

	Jakub
Christophe Lyon Jan. 24, 2020, 9:27 a.m. UTC | #2
On Mon, 20 Jan 2020 at 12:09, Jakub Jelinek <jakub@redhat.com> wrote:
>
> On Mon, Jan 20, 2020 at 12:04:12PM +0100, Richard Biener wrote:
> >
> > 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.
> >
> > Bootstrapped and tested on x86_64-unknown-linux-gnu, OK?
> >
> > Thanks,
> > Richard.
> >
> > 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.
>
> Ok.
>

Hi,

I have committed that attached patch as obvious: it requires the
fopenmp effective-target for the testcase, to avoid failures on
targets such as aarch64-elf or arm-eabi.

2020-01-24  Christophe Lyon  <christophe.lyon@linaro.org>

       PR debug/92763
       * g++.dg/debug/pr92763.C: Require fopenmp.

Thanks,

Christophe

>         Jakub
>
commit ad8e2415d6e2dc7c6f1206e78d48f999ff6b0bc4
Author: Christophe Lyon <christophe.lyon@linaro.org>
Date:   Fri Jan 24 09:07:58 2020 +0000

    debug/92763 Fix testcase to require fopenmp
    
    The testcase fails to link on targets without -pthread which is
    implied by -fopenmp. Use dg-require-effective-target fopenmp to avoid
    this problem.
    
    2020-01-24  Christophe Lyon  <christophe.lyon@linaro.org>
    
    	PR debug/92763
    	* g++.dg/debug/pr92763.C: Require fopenmp.

diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index df547bc..c465ff9 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2020-01-24  Christophe Lyon  <christophe.lyon@linaro.org>
+
+	PR debug/92763
+	* g++.dg/debug/pr92763.C: Require fopenmp.
+
 2020-01-23  David Malcolm  <dmalcolm@redhat.com>
 
 	PR analyzer/93367
diff --git a/gcc/testsuite/g++.dg/debug/pr92763.C b/gcc/testsuite/g++.dg/debug/pr92763.C
index 8e32d60..16dccf3 100644
--- a/gcc/testsuite/g++.dg/debug/pr92763.C
+++ b/gcc/testsuite/g++.dg/debug/pr92763.C
@@ -1,4 +1,5 @@
 // { dg-do compile }
+// { dg-require-effective-target fopenmp }
 // { dg-additional-options "-fno-var-tracking-assignments -fopenmp" }
 
 struct A

Patch
diff mbox series

diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 70b3fad13a2..fe46c7e1eee 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -29529,9 +29529,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))
@@ -29540,8 +29540,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/g++.dg/debug/pr92763.C b/gcc/testsuite/g++.dg/debug/pr92763.C
new file mode 100644
index 00000000000..8e32d60039f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/debug/pr92763.C
@@ -0,0 +1,19 @@ 
+// { dg-do compile }
+// { 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++)
+    {
+    }
+}