]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR debug/39379 (DW_TAG_imported* no longer emitted)
authorJakub Jelinek <jakub@redhat.com>
Thu, 5 Mar 2009 12:50:36 +0000 (13:50 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 5 Mar 2009 12:50:36 +0000 (13:50 +0100)
PR debug/39379
* tree-cfg.c (remove_useless_stmts_bind): Don't remove GIMPLE_BINDs
with blocks containing IMPORTED_DECLs in BLOCK_VARS.

* g++.dg/debug/dwarf2/imported-module-3.C: New test.
* g++.dg/debug/dwarf2/imported-module-4.C: New test.

From-SVN: r144640

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/debug/dwarf2/imported-module-3.C [new file with mode: 0644]
gcc/testsuite/g++.dg/debug/dwarf2/imported-module-4.C [new file with mode: 0644]
gcc/tree-cfg.c

index d2629d61ddfd7027f0837deccf4a4f621e7f76ae..a0ff5c863f2a9ce953c3a68ea7ad775f2235d4f5 100644 (file)
@@ -1,3 +1,9 @@
+2009-03-05  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/39379
+       * tree-cfg.c (remove_useless_stmts_bind): Don't remove GIMPLE_BINDs
+       with blocks containing IMPORTED_DECLs in BLOCK_VARS.
+
 2009-03-05  Uros Bizjak  <ubizjak@gmail.com>
 
        * config/i386/i386.md (R8_REG, R9_REG): New constants.
index fc15129ffc63a0f6ccd0e3c7d3b42008bdcb1fcd..f71de1c30e9b7ad46166c611efc091642ed89407 100644 (file)
@@ -1,3 +1,9 @@
+2009-03-05  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/39379
+       * g++.dg/debug/dwarf2/imported-module-3.C: New test.
+       * g++.dg/debug/dwarf2/imported-module-4.C: New test.
+
 2009-03-04  Jason Merrill  <jason@redhat.com>
 
        PR c++/13549
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/imported-module-3.C b/gcc/testsuite/g++.dg/debug/dwarf2/imported-module-3.C
new file mode 100644 (file)
index 0000000..d62a506
--- /dev/null
@@ -0,0 +1,17 @@
+// PR debug/39379
+// { dg-do compile }
+// { dg-options "-g -dA" }
+// { dg-final { scan-assembler "DW_TAG_imported" }  }
+
+namespace A
+{
+  int v;
+}
+
+int
+main ()
+{
+  using namespace A;
+  v++;
+  return v - 1;
+}
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/imported-module-4.C b/gcc/testsuite/g++.dg/debug/dwarf2/imported-module-4.C
new file mode 100644 (file)
index 0000000..6e9b52e
--- /dev/null
@@ -0,0 +1,21 @@
+// PR debug/39379
+// { dg-do compile }
+// { dg-options "-g -dA" }
+// { dg-final { scan-assembler "DW_TAG_imported" }  }
+
+namespace A
+{
+  int v;
+}
+
+int
+f ()
+{
+  int i;
+  {
+    using namespace A;
+    v++;
+    i = v - 1;
+  }
+  return i;
+}
index 5632a8930bccda2d1c1cd89c98dc777ed2a4aca7..440aa93682693a91224c9e383b7df2147b2a141e 100644 (file)
@@ -1796,9 +1796,21 @@ remove_useless_stmts_bind (gimple_stmt_iterator *gsi, struct rus_data *data ATTR
          || (TREE_CODE (BLOCK_ABSTRACT_ORIGIN (block))
              != FUNCTION_DECL)))
     {
-      gsi_insert_seq_before (gsi, body_seq, GSI_SAME_STMT);
-      gsi_remove (gsi, false);
-      data->repeat = true;
+      tree var = NULL_TREE;
+      /* Even if there are no gimple_bind_vars, there might be other
+        decls in BLOCK_VARS rendering the GIMPLE_BIND not useless.  */
+      if (block)
+       for (var = BLOCK_VARS (block); var; var = TREE_CHAIN (var))
+         if (TREE_CODE (var) == IMPORTED_DECL)
+           break;
+      if (var)
+       gsi_next (gsi);
+      else
+       {
+         gsi_insert_seq_before (gsi, body_seq, GSI_SAME_STMT);
+         gsi_remove (gsi, false);
+         data->repeat = true;
+       }
     }
   else
     gsi_next (gsi);