gcc/gcc41-pr33537.patch
Jakub Jelinek d8d9cbe2d6 4.1.2-34
2007-11-25 20:29:41 +00:00

63 lines
2.2 KiB
Diff

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).
--- gcc/dwarf2out.c (revision 129819)
+++ gcc/dwarf2out.c (revision 129820)
@@ -11832,8 +11832,11 @@ gen_formal_parameter_die (tree node, dw_
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
}
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 cont
/* 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 cont
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;