tstellar / rpms / gcc

Forked from rpms/gcc 4 years ago
Clone
0d16b69
2007-11-01  Jakub Jelinek  <jakub@redhat.com>
0d16b69
0d16b69
	PR debug/33537
0d16b69
	* dwarf2out.c (gen_formal_parameter_die, gen_variable_die,
0d16b69
	gen_decl_die): Use TREE_TYPE (TREE_TYPE (decl)) as type
0d16b69
	rather than TREE_TYPE (decl) if DECL_BY_REFERENCE (decl).
0d16b69
0d16b69
--- gcc/dwarf2out.c	(revision 129819)
0d16b69
+++ gcc/dwarf2out.c	(revision 129820)
0d16b69
@@ -11832,8 +11832,11 @@ gen_formal_parameter_die (tree node, dw_
0d16b69
 	add_abstract_origin_attribute (parm_die, origin);
0d16b69
       else
0d16b69
 	{
0d16b69
+	  tree type = TREE_TYPE (node);
0d16b69
 	  add_name_and_src_coords_attributes (parm_die, node);
0d16b69
-	  add_type_attribute (parm_die, TREE_TYPE (node),
0d16b69
+	  if (DECL_BY_REFERENCE (node))
0d16b69
+	    type = TREE_TYPE (type);
0d16b69
+	  add_type_attribute (parm_die, type,
0d16b69
 			      TREE_READONLY (node),
0d16b69
 			      TREE_THIS_VOLATILE (node),
0d16b69
 			      context_die);
0d16b69
@@ -12437,8 +12440,14 @@ gen_variable_die (tree decl, dw_die_ref 
0d16b69
     }
0d16b69
   else
0d16b69
     {
0d16b69
+      tree type = TREE_TYPE (decl);
0d16b69
+      if ((TREE_CODE (decl) == PARM_DECL
0d16b69
+	   || TREE_CODE (decl) == RESULT_DECL)
0d16b69
+	  && DECL_BY_REFERENCE (decl))
0d16b69
+	type = TREE_TYPE (type);
0d16b69
+
0d16b69
       add_name_and_src_coords_attributes (var_die, decl);
0d16b69
-      add_type_attribute (var_die, TREE_TYPE (decl), TREE_READONLY (decl),
0d16b69
+      add_type_attribute (var_die, type, TREE_READONLY (decl),
0d16b69
 			  TREE_THIS_VOLATILE (decl), context_die);
0d16b69
 
0d16b69
       if (TREE_PUBLIC (decl))
0d16b69
@@ -13694,7 +13703,10 @@ gen_decl_die (tree decl, dw_die_ref cont
0d16b69
 
0d16b69
       /* Output any DIEs that are needed to specify the type of this data
0d16b69
 	 object.  */
0d16b69
-      gen_type_die (TREE_TYPE (decl), context_die);
0d16b69
+      if (TREE_CODE (decl) == RESULT_DECL && DECL_BY_REFERENCE (decl))
0d16b69
+	gen_type_die (TREE_TYPE (TREE_TYPE (decl)), context_die);
0d16b69
+      else
0d16b69
+	gen_type_die (TREE_TYPE (decl), context_die);
0d16b69
 
0d16b69
       /* And its containing type.  */
0d16b69
       origin = decl_class_context (decl);
0d16b69
@@ -13728,7 +13740,10 @@ gen_decl_die (tree decl, dw_die_ref cont
0d16b69
       break;
0d16b69
 
0d16b69
     case PARM_DECL:
0d16b69
-      gen_type_die (TREE_TYPE (decl), context_die);
0d16b69
+      if (DECL_BY_REFERENCE (decl))
0d16b69
+	gen_type_die (TREE_TYPE (TREE_TYPE (decl)), context_die);
0d16b69
+      else
0d16b69
+	gen_type_die (TREE_TYPE (decl), context_die);
0d16b69
       gen_formal_parameter_die (decl, context_die);
0d16b69
       break;
0d16b69