From 8afb7c4b8a5f9f158e32723a7cf0ed0f514ecea7 Mon Sep 17 00:00:00 2001 From: jakub Date: Fri, 26 Oct 2012 19:19:25 +0000 Subject: 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@192860 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cfgexpand.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'gcc/cfgexpand.c') diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index 4ae1600d71c..ba86eb571ea 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; } -- cgit v1.2.1