diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-10-26 19:19:25 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-10-26 19:19:25 +0000 |
commit | 8afb7c4b8a5f9f158e32723a7cf0ed0f514ecea7 (patch) | |
tree | 007004e6f0b36e0efb8b580543d475b492da6928 /gcc/cfgexpand.c | |
parent | 49ef567352f7f2a333589c6a4b906e3d8fc6950a (diff) | |
download | gcc-8afb7c4b8a5f9f158e32723a7cf0ed0f514ecea7.tar.gz |
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
Diffstat (limited to 'gcc/cfgexpand.c')
-rw-r--r-- | gcc/cfgexpand.c | 21 |
1 files changed, 21 insertions, 0 deletions
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; } |