aboutsummaryrefslogtreecommitdiff
path: root/gcc/cfgexpand.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2012-10-26 21:19:25 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2012-10-26 21:19:25 +0200
commit9430b7bad813a444e6a7e35d6b5f92d2b99f40cf (patch)
tree007004e6f0b36e0efb8b580543d475b492da6928 /gcc/cfgexpand.c
parentc88538b7436c2e46f308b9b3410f04572078c2ae (diff)
downloadgcc-9430b7bad813a444e6a7e35d6b5f92d2b99f40cf.zip
gcc-9430b7bad813a444e6a7e35d6b5f92d2b99f40cf.tar.gz
gcc-9430b7bad813a444e6a7e35d6b5f92d2b99f40cf.tar.bz2
re PR debug/54970 (Missing DW_OP_GNU_implicit_pointer in debuginfo)
PR debug/54970 * cfgexpand.c (expand_debug_expr): Expand &MEM_REF[&var, n] as DEBUG_IMPLICIT_PTR + n if &var expands to DEBUG_IMPLICIT_PTR. * tree-sra.c (create_access_replacement): Allow also MEM_REFs with ADDR_EXPR first operand in DECL_DEBUG_EXPR expressions. * var-tracking.c (track_expr_p): Handle MEM_REFs in DECL_DEBUG_EXPR expressions. * dwarf2out.c (add_var_loc_to_decl): Likewise. PR debug/54971 * gcc.dg/guality/pr54970.c: New test. From-SVN: r192860
Diffstat (limited to 'gcc/cfgexpand.c')
-rw-r--r--gcc/cfgexpand.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 4ae1600..ba86eb5 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -3284,6 +3284,27 @@ expand_debug_expr (tree exp)
}
}
+ if (TREE_CODE (TREE_OPERAND (exp, 0)) == MEM_REF
+ && TREE_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0))
+ == ADDR_EXPR)
+ {
+ op0 = expand_debug_expr (TREE_OPERAND (TREE_OPERAND (exp, 0),
+ 0));
+ if (op0 != NULL
+ && (GET_CODE (op0) == DEBUG_IMPLICIT_PTR
+ || (GET_CODE (op0) == PLUS
+ && GET_CODE (XEXP (op0, 0)) == DEBUG_IMPLICIT_PTR
+ && CONST_INT_P (XEXP (op0, 1)))))
+ {
+ op1 = expand_debug_expr (TREE_OPERAND (TREE_OPERAND (exp, 0),
+ 1));
+ if (!op1 || !CONST_INT_P (op1))
+ return NULL;
+
+ return plus_constant (mode, op0, INTVAL (op1));
+ }
+ }
+
return NULL;
}