PR debug/58315: Mark cdtor_label as artificial
diff mbox

Message ID
State New
Headers show

Commit Message

Aldy Hernandez Feb. 24, 2015, 10:14 p.m. UTC
Technically this doesn't solve the issue in the PR, not by a long shot. 
  Alex has a patch for that already.  However, this is another problem I 
found while debugging this PR.

I saw a few of these useless debug statements in the gimple dumps, which 
couldn't be removed by DSE/DCE  because the labels are actually distinct:

# DEBUG <L0> => NULL
# DEBUG <L0> => NULL
# DEBUG <L0> => NULL

Interestingly, the labels are not user generated so there is no point in 
creating debug statements for them.  The problem was that 
DECL_ARTIFICIAL was not being set by the C++ FE, when clearly this is a 
compiler generated entity (I mean, it doesn't even have a name ;-)).

OK for mainline pending tests?
commit f113fced0629c2f47aa7f1ac91c7419a47ea9f3b
Author: Aldy Hernandez <>
Date:   Tue Feb 24 14:05:41 2015 -0800

    	PR debug/58315
    	* decl.c (start_preparsed_function): Mark cdtor_label as

diff mbox

diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 67c5ae7..0c1d54a 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -13723,6 +13723,7 @@  start_preparsed_function (tree decl1, tree attrs, int flags)
       cdtor_label = build_decl (input_location, 
 				LABEL_DECL, NULL_TREE, void_type_node);
+      DECL_ARTIFICIAL (cdtor_label) = 1;
       DECL_CONTEXT (cdtor_label) = current_function_decl;