re PR debug/21828 (debug info omitted for uninitialized variables)
authorMark Mitchell <mark@codesourcery.com>
Fri, 22 Jul 2005 17:40:37 +0000 (17:40 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Fri, 22 Jul 2005 17:40:37 +0000 (17:40 +0000)
PR debug/21828
* toplev.c (check_global_declarations): Do not mark undefined
variables as DECL_IGNORED_P.
* varasm.c (first_global_object_name): GTY it.
(weak_global_object_name): Likewise.
(notice_global_symbol): Use ggc_strdup, not xstrdup, when creating
a string to go into {weak,first}_global_object_name.

PR debug/21828
* gcc.dg/debug/dwarf2/dwarf-uninit.c: New test.

From-SVN: r102287

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-uninit.c [new file with mode: 0644]
gcc/toplev.c
gcc/varasm.c

index 75ca975defdaa408cab563ee71ca288cf5c98e99..b4b36143da0abc4dd9739a421e197fefe5111dd1 100644 (file)
@@ -1,3 +1,13 @@
+2005-07-22  Mark Mitchell  <mark@codesourcery.com>
+
+       PR debug/21828
+       * toplev.c (check_global_declarations): Do not mark undefined
+       variables as DECL_IGNORED_P.
+       * varasm.c (first_global_object_name): GTY it.
+       (weak_global_object_name): Likewise.
+       (notice_global_symbol): Use ggc_strdup, not xstrdup, when creating
+       a string to go into {weak,first}_global_object_name.
+
 2005-07-22  DJ Delorie  <dj@redhat.com>
 
        * c-format.c (check_function_format): Change warning control
index 25db24b931a885f2228bf5acf99ac1024974b2c7..64a5887655ad714fc35e3c424fb23b5424915989 100644 (file)
@@ -1,3 +1,8 @@
+2005-07-22  Mark Mitchell  <mark@codesourcery.com>
+
+       PR debug/21828
+       * gcc.dg/debug/dwarf2/dwarf-uninit.c: New test.
+
 2005-07-22  Diego Novillo  <dnovillo@redhat.com>
 
        * gcc.dg/tree-ssa/20050719-1.c: New test.
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-uninit.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-uninit.c
new file mode 100644 (file)
index 0000000..f0237cc
--- /dev/null
@@ -0,0 +1,10 @@
+/* { dg-do compile */
+/* { dg-options "-O2 -gdwarf-2 -dA" } */
+/* { dg-final { scan-assembler "DW_TAG_variable" } } */
+/* PR debug/21828 */
+
+static int i;
+int main() {
+  i += 3;
+  return 0;
+}
index 5ad62dd6ecfe2e6671225c7173f5ad2571ad5e51..b5ee33b33b8e299f44ff04e380aa1a7a48ae2c78 100644 (file)
@@ -802,13 +802,6 @@ check_global_declarations (tree *vec, int len)
     {
       decl = vec[i];
 
-      /* Do not emit debug information about variables that are in
-        static storage, but not defined.  */
-      if (TREE_CODE (decl) == VAR_DECL
-         && TREE_STATIC (decl)
-         && !TREE_ASM_WRITTEN (decl))
-       DECL_IGNORED_P (decl) = 1;
       /* Warn about any function
         declared static but not defined.
         We don't warn about variables,
index e4d30974ddc9eb3230d4332f4cb112dada22dd4f..3ef81468850255ed4bd101caf86fdec7ba34834d 100644 (file)
@@ -60,6 +60,9 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
 #endif
 
 /* The (assembler) name of the first globally-visible object output.  */
+extern GTY(()) const char *first_global_object_name;
+extern GTY(()) const char *weak_global_object_name;
+
 const char *first_global_object_name;
 const char *weak_global_object_name;
 
@@ -1207,11 +1210,11 @@ notice_global_symbol (tree decl)
   if (!*type)
     {
       const char *p;
-      char *name;
+      const char *name;
       rtx decl_rtl = DECL_RTL (decl);
 
       p = targetm.strip_name_encoding (XSTR (XEXP (decl_rtl, 0), 0));
-      name = xstrdup (p);
+      name = ggc_strdup (p);
 
       *type = name;
     }