OSDN Git Service

PR Debug/23205
authordpatel <dpatel@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 6 Oct 2005 00:47:21 +0000 (00:47 +0000)
committerdpatel <dpatel@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 6 Oct 2005 00:47:21 +0000 (00:47 +0000)
       * dbxout.c (dbxout_symbol): Check DECL_RTL_SET_P, after
       handling constants. Check NAMESPACE_DECL context for constants.

       * g++.dg/other/PR23205.C: New.

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

gcc/ChangeLog
gcc/dbxout.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/other/PR23205.C [new file with mode: 0644]

index 7ea9415..1ef72bc 100644 (file)
@@ -1,3 +1,9 @@
+2005-10-05  Devang Patel  <dpatel@apple.com>
+
+       PR Debug/23205
+       * dbxout.c (dbxout_symbol): Check DECL_RTL_SET_P, after
+       handling constants. Check NAMESPACE_DECL context for constants.
+       
 2005-10-05  Eric Christopher  <echristo@apple.com>
 
        * doc/md.texi (Standard Names): Fix name of pushm1 pattern.
index d295ac7..9ffced0 100644 (file)
@@ -2671,10 +2671,6 @@ dbxout_symbol (tree decl, int local ATTRIBUTE_UNUSED)
       if (DECL_EXTERNAL (decl))
        break;
 
-      decl_rtl = dbxout_expand_expr (decl);
-      if (!decl_rtl)
-       DBXOUT_DECR_NESTING_AND_RETURN (0);
-
       /* If the variable is really a constant
         and not written in memory, inform the debugger.
 
@@ -2684,7 +2680,8 @@ dbxout_symbol (tree decl, int local ATTRIBUTE_UNUSED)
          && host_integerp (DECL_INITIAL (decl), 0)
          && ! TREE_ASM_WRITTEN (decl)
          && (DECL_CONTEXT (decl) == NULL_TREE
-             || TREE_CODE (DECL_CONTEXT (decl)) == BLOCK)
+             || TREE_CODE (DECL_CONTEXT (decl)) == BLOCK
+             || TREE_CODE (DECL_CONTEXT (decl)) == NAMESPACE_DECL)
          && TREE_PUBLIC (decl) == 0)
        {
          /* The sun4 assembler does not grok this.  */
@@ -2695,8 +2692,8 @@ dbxout_symbol (tree decl, int local ATTRIBUTE_UNUSED)
              HOST_WIDE_INT ival = TREE_INT_CST_LOW (DECL_INITIAL (decl));
 
              dbxout_begin_complex_stabs ();
-             stabstr_I (DECL_NAME (decl));
-             stabstr_S (":c=i");
+             dbxout_symbol_name (decl, NULL, 'c');
+             stabstr_S ("=i");
              stabstr_D (ival);
              dbxout_finish_complex_stabs (0, N_LSYM, 0, 0, 0);
              DBXOUT_DECR_NESTING;
@@ -2707,6 +2704,10 @@ dbxout_symbol (tree decl, int local ATTRIBUTE_UNUSED)
        }
       /* else it is something we handle like a normal variable.  */
 
+      decl_rtl = dbxout_expand_expr (decl);
+      if (!decl_rtl)
+       DBXOUT_DECR_NESTING_AND_RETURN (0);
+
       decl_rtl = eliminate_regs (decl_rtl, 0, NULL_RTX);
 #ifdef LEAF_REG_REMAP
       if (current_function_uses_only_leaf_regs)
index 8d26dd2..be22aa9 100644 (file)
@@ -1,3 +1,8 @@
+2005-10-05  Devang Patel  <dpatel@apple.com>
+
+       PR Debug/23205
+       * g++.dg/other/PR23205.C: New.
+       
 2005-10-05  Richard Henderson  <rth@redhat.com>
 
        PR target/23602
diff --git a/gcc/testsuite/g++.dg/other/PR23205.C b/gcc/testsuite/g++.dg/other/PR23205.C
new file mode 100644 (file)
index 0000000..6852f82
--- /dev/null
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-skip-if "No stabs" { mmix-*-* *-*-aix* *-*-netware* alpha*-*-* hppa*64*-*-* ia64-*-* } { "*" } { "" } } */
+/* { dg-options "-gstabs+ -fno-eliminate-unused-debug-types" } */
+
+const int foobar = 4;
+int foo ()
+{
+        return foobar + 1;
+}
+
+int main()
+{
+        int i;
+        i = foo();
+        return i;
+}
+
+/* { dg-final { scan-assembler ".stabs.*foobar:c=i" } } */