aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2005-07-22 17:40:37 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2005-07-22 17:40:37 +0000
commit9881e3e5e8b19559f67332ea3f027c315933aed0 (patch)
tree0803afaa84c77bde73aa2d88d39c8c1d727a9b2c /gcc
parent1a8d0d41ac5e1593cebec8a1fc7b01d5e61f7018 (diff)
downloadgcc-9881e3e5e8b19559f67332ea3f027c315933aed0.zip
gcc-9881e3e5e8b19559f67332ea3f027c315933aed0.tar.gz
gcc-9881e3e5e8b19559f67332ea3f027c315933aed0.tar.bz2
re PR debug/21828 (debug info omitted for uninitialized variables)
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-uninit.c10
-rw-r--r--gcc/toplev.c7
-rw-r--r--gcc/varasm.c7
5 files changed, 30 insertions, 9 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 75ca975..b4b3614 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 25db24b..64a5887 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 0000000..f0237cc
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-uninit.c
@@ -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;
+}
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 5ad62dd..b5ee33b 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -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,
diff --git a/gcc/varasm.c b/gcc/varasm.c
index e4d3097..3ef8146 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -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;
}