This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
C++ PATCH for useless NOTE_INSN_DELETED_DEBUG_LABELs
- From: Jason Merrill <jason at redhat dot com>
- To: gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Cc: Aldy Hernandez <aldyh at redhat dot com>, Jakub Jelinek <jakub at redhat dot com>
- Date: Wed, 25 Feb 2015 10:49:18 -0500
- Subject: C++ PATCH for useless NOTE_INSN_DELETED_DEBUG_LABELs
- Authentication-results: sourceware.org; auth=none
This isn't the main problem in debug/58315, but when looking at it I saw
a bunch of useless
# DEBUG <L0> => NULL
lines, which turned out to be deleted debug labels notes for the
cdtor_label created in start_preparsed_function. Since this is an
internal, unnamed label, we shouldn't have debug information about it,
but we were forgetting to mark it as artificial.
Tested x86_64-pc-linux-gnu, applying to trunk.
commit b7d4cc82f45a906012f13d084af09840c1e37bc0
Author: Jason Merrill <jason@redhat.com>
Date: Wed Feb 25 08:53:43 2015 -0500
PR debug/58315
* decl.c (start_preparsed_function): Use create_artificial_label
for cdtor_label.
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 67c5ae7..83e060b 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -13721,9 +13721,7 @@ start_preparsed_function (tree decl1, tree attrs, int flags)
|| (DECL_CONSTRUCTOR_P (decl1)
&& targetm.cxx.cdtor_returns_this ()))
{
- cdtor_label = build_decl (input_location,
- LABEL_DECL, NULL_TREE, void_type_node);
- DECL_CONTEXT (cdtor_label) = current_function_decl;
+ cdtor_label = create_artificial_label (input_location);
}
start_fname_decls ();
diff --git a/gcc/testsuite/g++.dg/tree-ssa/deleted-label1.C b/gcc/testsuite/g++.dg/tree-ssa/deleted-label1.C
new file mode 100644
index 0000000..11c06be
--- /dev/null
+++ b/gcc/testsuite/g++.dg/tree-ssa/deleted-label1.C
@@ -0,0 +1,19 @@
+// PR debug/58315
+// { dg-options "-O -g -fdump-tree-einline" }
+// { dg-final { scan-tree-dump-not "DEBUG <L0>" "einline" } }
+// { dg-final { cleanup-tree-dump "einline" } }
+
+// We used to emit useless NOTE_INSN_DELETED_DEBUG_LABELs for the
+// artificial cdtor_label.
+
+struct A
+{
+ ~A() {}
+};
+
+struct B: A {};
+
+int main()
+{
+ A a;
+}