re PR debug/33537 (C++ arguments passed by invisible reference have wrong type)
authorJakub Jelinek <jakub@redhat.com>
Thu, 1 Nov 2007 10:17:42 +0000 (11:17 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 1 Nov 2007 10:17:42 +0000 (11:17 +0100)
PR debug/33537
* dwarf2out.c (gen_formal_parameter_die, gen_variable_die,
gen_decl_die): Use TREE_TYPE (TREE_TYPE (decl)) as type
rather than TREE_TYPE (decl) if DECL_BY_REFERENCE (decl).

From-SVN: r129820

gcc/ChangeLog
gcc/dwarf2out.c

index 0aa3b00c8b6ba20d1393551becfe693242a3bffa..a5c3a9ec5f5643958b08f491c9ac4bf7e5043a54 100644 (file)
@@ -1,5 +1,10 @@
 2007-11-01  Jakub Jelinek  <jakub@redhat.com>
 
+       PR debug/33537
+       * dwarf2out.c (gen_formal_parameter_die, gen_variable_die,
+       gen_decl_die): Use TREE_TYPE (TREE_TYPE (decl)) as type
+       rather than TREE_TYPE (decl) if DECL_BY_REFERENCE (decl).
+
        PR rtl-optimization/33673
        * gcse.c (cprop_jump): If a conditional jump has been optimized
        into unconditional jump, make the remaining normal edge fallthru
index 46e2b59dff11ba82978f290522240352244e46d1..a9510ebba2ca81cd4f848bd3b0e3c9b98106382f 100644 (file)
@@ -11832,8 +11832,11 @@ gen_formal_parameter_die (tree node, dw_die_ref context_die)
        add_abstract_origin_attribute (parm_die, origin);
       else
        {
+         tree type = TREE_TYPE (node);
          add_name_and_src_coords_attributes (parm_die, node);
-         add_type_attribute (parm_die, TREE_TYPE (node),
+         if (DECL_BY_REFERENCE (node))
+           type = TREE_TYPE (type);
+         add_type_attribute (parm_die, type,
                              TREE_READONLY (node),
                              TREE_THIS_VOLATILE (node),
                              context_die);
@@ -12437,8 +12440,14 @@ gen_variable_die (tree decl, dw_die_ref context_die)
     }
   else
     {
+      tree type = TREE_TYPE (decl);
+      if ((TREE_CODE (decl) == PARM_DECL
+          || TREE_CODE (decl) == RESULT_DECL)
+         && DECL_BY_REFERENCE (decl))
+       type = TREE_TYPE (type);
+
       add_name_and_src_coords_attributes (var_die, decl);
-      add_type_attribute (var_die, TREE_TYPE (decl), TREE_READONLY (decl),
+      add_type_attribute (var_die, type, TREE_READONLY (decl),
                          TREE_THIS_VOLATILE (decl), context_die);
 
       if (TREE_PUBLIC (decl))
@@ -13694,7 +13703,10 @@ gen_decl_die (tree decl, dw_die_ref context_die)
 
       /* Output any DIEs that are needed to specify the type of this data
         object.  */
-      gen_type_die (TREE_TYPE (decl), context_die);
+      if (TREE_CODE (decl) == RESULT_DECL && DECL_BY_REFERENCE (decl))
+       gen_type_die (TREE_TYPE (TREE_TYPE (decl)), context_die);
+      else
+       gen_type_die (TREE_TYPE (decl), context_die);
 
       /* And its containing type.  */
       origin = decl_class_context (decl);
@@ -13728,7 +13740,10 @@ gen_decl_die (tree decl, dw_die_ref context_die)
       break;
 
     case PARM_DECL:
-      gen_type_die (TREE_TYPE (decl), context_die);
+      if (DECL_BY_REFERENCE (decl))
+       gen_type_die (TREE_TYPE (TREE_TYPE (decl)), context_die);
+      else
+       gen_type_die (TREE_TYPE (decl), context_die);
       gen_formal_parameter_die (decl, context_die);
       break;