]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
2018-07-12 Richard Biener <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 12 Jul 2018 12:32:30 +0000 (12:32 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 12 Jul 2018 12:32:30 +0000 (12:32 +0000)
PR debug/86462
* dwarf2out.c (gen_block_die): Only output blocks when they have
at least one !DECL_IGNORED_P variable.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@262583 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/dwarf2out.c

index a337db4485020125526e660a17ed98d80e20b33c..6332f29c8bc2939a81b09781eceb4086890621de 100644 (file)
@@ -1,3 +1,9 @@
+2018-07-12  Richard Biener  <rguenther@suse.de>
+
+       PR debug/86462
+       * dwarf2out.c (gen_block_die): Only output blocks when they have
+       at least one !DECL_IGNORED_P variable.
+
 2018-07-12  Richard Biener  <rguenther@suse.de>
 
        PR target/84829
index 1127713cbafcb7f0bc9cd1d690e2528def964967..c2422e29658b6a101034318deed224271e6f1ca7 100644 (file)
@@ -25627,22 +25627,28 @@ gen_block_die (tree stmt, dw_die_ref context_die)
        we might have pruned all BLOCK_VARS as optimized out but we
        still want to generate high/low PC attributes so output it.  */
     must_output_die = 1;
-  else
+  else if (TREE_USED (stmt)
+          || TREE_ASM_WRITTEN (stmt)
+          || BLOCK_ABSTRACT (stmt))
     {
       /* Determine if this block directly contains any "significant"
         local declarations which we will need to output DIEs for.  */
       if (debug_info_level > DINFO_LEVEL_TERSE)
-       /* We are not in terse mode so *any* local declaration counts
-          as being a "significant" one.  */
-       must_output_die = ((BLOCK_VARS (stmt) != NULL
-                           || BLOCK_NUM_NONLOCALIZED_VARS (stmt))
-                          && (TREE_USED (stmt)
-                              || TREE_ASM_WRITTEN (stmt)
-                              || BLOCK_ABSTRACT (stmt)));
-      else if ((TREE_USED (stmt)
-               || TREE_ASM_WRITTEN (stmt)
-               || BLOCK_ABSTRACT (stmt))
-              && !dwarf2out_ignore_block (stmt))
+       {
+         /* We are not in terse mode so any local declaration that
+            is not ignored for debug purposes counts as being a
+            "significant" one.  */
+         if (BLOCK_NUM_NONLOCALIZED_VARS (stmt))
+           must_output_die = 1;
+         else
+           for (tree var = BLOCK_VARS (stmt); var; var = DECL_CHAIN (var))
+             if (!DECL_IGNORED_P (var))
+               {
+                 must_output_die = 1;
+                 break;
+               }
+       }
+      else if (!dwarf2out_ignore_block (stmt))
        must_output_die = 1;
     }