This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

fix debug/20998


On the C++ side, a heartening matter of removing code to use the bits
that gimple added to support this same idea.  Then a tad more code to
make stabs use it; dwarf2 already did.  The same ought to be done with
sdbout, but I don't even know how to test that.

A similar patch will be committed for 4.0.


r~


        * dbxout.c: Include expr.h.
        (dbxout_global_decl): Don't suppress for DECL_RTL unset.
        (dbxout_symbol): Handle DECL_VALUE_EXPR.
        * Makefile.in (dbxout.o): Add EXPR_H.
cp/
        * cp-tree.def (ALIAS_DECL): Remove.
        * cp-lang.c (cp_init_ts): Remove support for it.
        * error.c (dump_decl): Likewise.
        * name-lookup.c (pushdecl): Likewise.
        * semantics.c (finish_id_expression): Likewise.
        * decl2.c (build_anon_union_vars): Use a VAR_DECL with
        DECL_VALUE_EXPR instead.

Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.1537
diff -u -p -d -r1.1537 Makefile.in
--- Makefile.in	29 Aug 2005 13:52:32 -0000	1.1537
+++ Makefile.in	9 Sep 2005 08:36:48 -0000
@@ -2103,10 +2103,10 @@ optabs.o : optabs.c $(CONFIG_H) $(SYSTEM
    $(TREE_H) $(FLAGS_H) insn-config.h $(EXPR_H) $(OPTABS_H) libfuncs.h \
    $(RECOG_H) reload.h toplev.h $(GGC_H) real.h $(TM_P_H) except.h \
    gt-optabs.h $(BASIC_BLOCK_H) $(TARGET_H) function.h
-dbxout.o : dbxout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(RTL_H) \
-   $(FLAGS_H) $(REGS_H) debug.h $(TM_P_H) $(TARGET_H) function.h langhooks.h \
-   insn-config.h reload.h gstab.h xcoffout.h output.h dbxout.h toplev.h \
-   $(GGC_H) $(OBSTACK_H) gt-dbxout.h
+dbxout.o : dbxout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
+   $(RTL_H) $(FLAGS_H) $(REGS_H) debug.h $(TM_P_H) $(TARGET_H) function.h \
+   langhooks.h insn-config.h reload.h gstab.h xcoffout.h output.h dbxout.h \
+   toplev.h $(GGC_H) $(OBSTACK_H) $(EXPR_H) gt-dbxout.h
 debug.o : debug.c debug.h $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H)
 sdbout.o : sdbout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) debug.h \
    $(TREE_H) $(GGC_H) $(RTL_H) $(REGS_H) $(FLAGS_H) insn-config.h \
Index: dbxout.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/dbxout.c,v
retrieving revision 1.237
diff -u -p -d -r1.237 dbxout.c
--- dbxout.c	20 Jul 2005 00:24:44 -0000	1.237
+++ dbxout.c	9 Sep 2005 08:36:49 -0000
@@ -89,6 +89,7 @@ Software Foundation, 51 Franklin Street,
 #include "target.h"
 #include "langhooks.h"
 #include "obstack.h"
+#include "expr.h"
 
 #ifdef XCOFF_DEBUGGING_INFO
 #include "xcoffout.h"
@@ -1319,9 +1320,7 @@ dbxout_function_decl (tree decl)
 static void
 dbxout_global_decl (tree decl)
 {
-  if (TREE_CODE (decl) == VAR_DECL
-      && ! DECL_EXTERNAL (decl)
-      && DECL_RTL_SET_P (decl))	/* Not necessary?  */
+  if (TREE_CODE (decl) == VAR_DECL && !DECL_EXTERNAL (decl))
     {
       int saved_tree_used = TREE_USED (decl);
       TREE_USED (decl) = 1;
@@ -2337,6 +2336,7 @@ dbxout_symbol (tree decl, int local ATTR
   tree type = TREE_TYPE (decl);
   tree context = NULL_TREE;
   int result = 0;
+  rtx decl_rtl;
 
   /* "Intercept" dbxout_symbol() calls like we do all debug_hooks.  */
   ++debug_nesting;
@@ -2421,7 +2421,8 @@ dbxout_symbol (tree decl, int local ATTR
       break;
 
     case FUNCTION_DECL:
-      if (DECL_RTL (decl) == 0)
+      decl_rtl = DECL_RTL_IF_SET (decl);
+      if (!decl_rtl)
 	DBXOUT_DECR_NESTING_AND_RETURN (0);
       if (DECL_EXTERNAL (decl))
 	break;
@@ -2432,8 +2433,8 @@ dbxout_symbol (tree decl, int local ATTR
       /* Don't mention an inline instance of a nested function.  */
       if (context && DECL_FROM_INLINE (decl))
 	break;
-      if (!MEM_P (DECL_RTL (decl))
-	  || GET_CODE (XEXP (DECL_RTL (decl), 0)) != SYMBOL_REF)
+      if (!MEM_P (decl_rtl)
+	  || GET_CODE (XEXP (decl_rtl, 0)) != SYMBOL_REF)
 	break;
 
       dbxout_begin_complex_stabs ();
@@ -2457,8 +2458,7 @@ dbxout_symbol (tree decl, int local ATTR
 	  stabstr_I (DECL_NAME (context));
 	}
 
-      dbxout_finish_complex_stabs (decl, N_FUN, XEXP (DECL_RTL (decl), 0),
-				   0, 0);
+      dbxout_finish_complex_stabs (decl, N_FUN, XEXP (decl_rtl, 0), 0, 0);
       break;
 
     case TYPE_DECL:
@@ -2609,14 +2609,25 @@ dbxout_symbol (tree decl, int local ATTR
 
     case RESULT_DECL:
       /* Named return value, treat like a VAR_DECL.  */
+      decl_rtl = DECL_RTL_IF_SET (decl);
+      goto do_var_decl;
+
     case VAR_DECL:
-      if (! DECL_RTL_SET_P (decl))
-	DBXOUT_DECR_NESTING_AND_RETURN (0);
       /* Don't mention a variable that is external.
 	 Let the file that defines it describe it.  */
       if (DECL_EXTERNAL (decl))
 	break;
 
+      if (DECL_HAS_VALUE_EXPR_P (decl))
+	decl_rtl = expand_expr (DECL_VALUE_EXPR (decl), NULL_RTX, VOIDmode,
+				EXPAND_INITIALIZER);
+      else
+	decl_rtl = DECL_RTL_IF_SET (decl);
+
+    do_var_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.
 
@@ -2649,13 +2660,13 @@ dbxout_symbol (tree decl, int local ATTR
 	}
       /* else it is something we handle like a normal variable.  */
 
-      SET_DECL_RTL (decl, eliminate_regs (DECL_RTL (decl), 0, NULL_RTX));
+      decl_rtl = eliminate_regs (decl_rtl, 0, NULL_RTX);
 #ifdef LEAF_REG_REMAP
       if (current_function_uses_only_leaf_regs)
-	leaf_renumber_regs_insn (DECL_RTL (decl));
+	leaf_renumber_regs_insn (decl_rtl);
 #endif
 
-      result = dbxout_symbol_location (decl, type, 0, DECL_RTL (decl));
+      result = dbxout_symbol_location (decl, type, 0, decl_rtl);
       break;
 
     default:
Index: cp/cp-lang.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/cp-lang.c,v
retrieving revision 1.100
diff -u -p -d -r1.100 cp-lang.c
--- cp/cp-lang.c	9 Jul 2005 15:45:08 -0000	1.100
+++ cp/cp-lang.c	9 Sep 2005 08:36:53 -0000
@@ -117,27 +117,22 @@ cp_init_ts (void)
   tree_contains_struct[NAMESPACE_DECL][TS_DECL_NON_COMMON] = 1;
   tree_contains_struct[USING_DECL][TS_DECL_NON_COMMON] = 1;
   tree_contains_struct[TEMPLATE_DECL][TS_DECL_NON_COMMON] = 1;
-  tree_contains_struct[ALIAS_DECL][TS_DECL_NON_COMMON] = 1;
 
   tree_contains_struct[NAMESPACE_DECL][TS_DECL_WITH_VIS] = 1;
   tree_contains_struct[USING_DECL][TS_DECL_WITH_VIS] = 1;
   tree_contains_struct[TEMPLATE_DECL][TS_DECL_WITH_VIS] = 1;
-  tree_contains_struct[ALIAS_DECL][TS_DECL_WITH_VIS] = 1;
 
   tree_contains_struct[NAMESPACE_DECL][TS_DECL_WRTL] = 1;
   tree_contains_struct[USING_DECL][TS_DECL_WRTL] = 1;
   tree_contains_struct[TEMPLATE_DECL][TS_DECL_WRTL] = 1;
-  tree_contains_struct[ALIAS_DECL][TS_DECL_WRTL] = 1;
   
   tree_contains_struct[NAMESPACE_DECL][TS_DECL_COMMON] = 1;
   tree_contains_struct[USING_DECL][TS_DECL_COMMON] = 1;
   tree_contains_struct[TEMPLATE_DECL][TS_DECL_COMMON] = 1;
-  tree_contains_struct[ALIAS_DECL][TS_DECL_COMMON] = 1;
  
   tree_contains_struct[NAMESPACE_DECL][TS_DECL_MINIMAL] = 1;
   tree_contains_struct[USING_DECL][TS_DECL_MINIMAL] = 1;
   tree_contains_struct[TEMPLATE_DECL][TS_DECL_MINIMAL] = 1;
-  tree_contains_struct[ALIAS_DECL][TS_DECL_MINIMAL] = 1;
 
   init_shadowed_var_for_decl ();
 
Index: cp/cp-tree.def
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/cp-tree.def,v
retrieving revision 1.108
diff -u -p -d -r1.108 cp-tree.def
--- cp/cp-tree.def	25 Jun 2005 00:58:10 -0000	1.108
+++ cp/cp-tree.def	9 Sep 2005 08:36:53 -0000
@@ -87,10 +87,6 @@ DEFTREECODE (THROW_EXPR, "throw_expr", t
    these to avoid actually creating instances of the empty classes.  */
 DEFTREECODE (EMPTY_CLASS_EXPR, "empty_class_expr", tcc_expression, 0)
 
-/* A DECL which is really just a placeholder for an expression.  Used to
-   implement non-class scope anonymous unions.  */
-DEFTREECODE (ALIAS_DECL, "alias_decl", tcc_declaration, 0)
-
 /* A reference to a member function or member functions from a base
    class.  BASELINK_FUNCTIONS gives the FUNCTION_DECL,
    TEMPLATE_DECL, OVERLOAD, or TEMPLATE_ID_EXPR corresponding to the
Index: cp/decl2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl2.c,v
retrieving revision 1.798
diff -u -p -d -r1.798 decl2.c
--- cp/decl2.c	8 Sep 2005 18:56:40 -0000	1.798
+++ cp/decl2.c	9 Sep 2005 08:36:53 -0000
@@ -1057,7 +1057,7 @@ cplus_decl_attributes (tree *decl, tree 
 }
 
 /* Walks through the namespace- or function-scope anonymous union
-   OBJECT, with the indicated TYPE, building appropriate ALIAS_DECLs.
+   OBJECT, with the indicated TYPE, building appropriate VAR_DECLs.
    Returns one of the fields for use in the mangled name.  */
 
 static tree
@@ -1101,11 +1101,12 @@ build_anon_union_vars (tree type, tree o
 
       if (DECL_NAME (field))
 	{
-	  decl = build_decl (ALIAS_DECL, DECL_NAME (field), TREE_TYPE (field));
-	  DECL_INITIAL (decl) = ref;
-	  TREE_PUBLIC (decl) = 0;
-	  TREE_STATIC (decl) = 0;
-	  DECL_EXTERNAL (decl) = 1;
+	  decl = build_decl (VAR_DECL, DECL_NAME (field), TREE_TYPE (field));
+	  TREE_PUBLIC (decl) = TREE_PUBLIC (object);
+	  TREE_STATIC (decl) = TREE_PUBLIC (object);
+	  DECL_EXTERNAL (decl) = DECL_EXTERNAL (object);
+	  SET_DECL_VALUE_EXPR (decl, ref);
+	  DECL_HAS_VALUE_EXPR_P (decl) = 1;
 	  decl = pushdecl (decl);
 	}
       else if (ANON_AGGR_TYPE_P (TREE_TYPE (field)))
Index: cp/error.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/error.c,v
retrieving revision 1.290
diff -u -p -d -r1.290 error.c
--- cp/error.c	20 Jul 2005 01:19:13 -0000	1.290
+++ cp/error.c	9 Sep 2005 08:36:54 -0000
@@ -744,7 +744,6 @@ dump_decl (tree t, int flags)
       /* Else fall through.  */
     case FIELD_DECL:
     case PARM_DECL:
-    case ALIAS_DECL:
       dump_simple_decl (t, TREE_TYPE (t), flags);
       break;
 
Index: cp/name-lookup.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/name-lookup.c,v
retrieving revision 1.139
diff -u -p -d -r1.139 name-lookup.c
--- cp/name-lookup.c	30 Aug 2005 16:22:00 -0000	1.139
+++ cp/name-lookup.c	9 Sep 2005 08:36:54 -0000
@@ -831,7 +831,6 @@ pushdecl (tree x)
 		&& t != NULL_TREE)
 	      && (TREE_CODE (x) == TYPE_DECL
 		  || TREE_CODE (x) == VAR_DECL
-		  || TREE_CODE (x) == ALIAS_DECL
 		  || TREE_CODE (x) == NAMESPACE_DECL
 		  || TREE_CODE (x) == CONST_DECL
 		  || TREE_CODE (x) == TEMPLATE_DECL))
Index: cp/semantics.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/semantics.c,v
retrieving revision 1.487
diff -u -p -d -r1.487 semantics.c
--- cp/semantics.c	6 Sep 2005 20:07:02 -0000	1.487
+++ cp/semantics.c	9 Sep 2005 08:36:55 -0000
@@ -2761,11 +2761,6 @@ finish_id_expression (tree id_expression
 
 	  decl = convert_from_reference (decl);
 	}
-
-      /* Resolve references to variables of anonymous unions
-	 into COMPONENT_REFs.  */
-      if (TREE_CODE (decl) == ALIAS_DECL)
-	decl = unshare_expr (DECL_INITIAL (decl));
     }
 
   if (TREE_DEPRECATED (decl))


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]