re PR debug/58315 (Excessive memory use with -g)
authorJason Merrill <jason@redhat.com>
Wed, 25 Feb 2015 15:49:34 +0000 (10:49 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 25 Feb 2015 15:49:34 +0000 (10:49 -0500)
PR debug/58315
* decl.c (start_preparsed_function): Use create_artificial_label
for cdtor_label.

From-SVN: r220974

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/g++.dg/tree-ssa/deleted-label1.C [new file with mode: 0644]

index 115a9f3700a4b54eb4dc24765a90f221c4ab33b5..fbebe8e324c3f27cde443e5249cba84f39fd7bc3 100644 (file)
@@ -1,3 +1,9 @@
+2015-02-25  Jason Merrill  <jason@redhat.com>
+
+       PR debug/58315
+       * decl.c (start_preparsed_function): Use create_artificial_label
+       for cdtor_label.
+
 2015-02-17  Paolo Carlini  <paolo.carlini@oracle.com>
            Jakub Jelinek  <jakub@redhat.com>
 
index 67c5ae73e361b6f28d8e9f201dd7fef31dd08f6f..83e060b4d11723d7eb6c1e5e72d39721746607a0 100644 (file)
@@ -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 (file)
index 0000000..11c06be
--- /dev/null
@@ -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;
+}