aboutsummaryrefslogtreecommitdiff
path: root/gcc/dwarf2out.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-11-01 11:17:42 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2007-11-01 11:17:42 +0100
commit611cd333cd03e3b44902223cd8f945a54e9ec843 (patch)
tree3e778dea3fc779cfc91481f7e3fe32b0fcb42c6c /gcc/dwarf2out.c
parentd0a55efc8463a68632498a84cffa7b84fe3d6e26 (diff)
downloadgcc-611cd333cd03e3b44902223cd8f945a54e9ec843.zip
gcc-611cd333cd03e3b44902223cd8f945a54e9ec843.tar.gz
gcc-611cd333cd03e3b44902223cd8f945a54e9ec843.tar.bz2
re PR debug/33537 (C++ arguments passed by invisible reference have wrong type)
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
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r--gcc/dwarf2out.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 46e2b59..a9510eb 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -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;