diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2014-06-06 08:13:24 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2014-06-06 08:13:24 +0000 |
commit | 3fd48b121a654c914b2784334650d23095d938e4 (patch) | |
tree | a57bf7572560464ca1f1c66047de9e49d3a81f12 /gcc/function.c | |
parent | 9b7a11e15385db8fe350c7b3f90f8530c18f2a11 (diff) | |
download | gcc-3fd48b121a654c914b2784334650d23095d938e4.zip gcc-3fd48b121a654c914b2784334650d23095d938e4.tar.gz gcc-3fd48b121a654c914b2784334650d23095d938e4.tar.bz2 |
re PR debug/53927 (wrong value for DW_AT_static_link)
PR debug/53927
* function.c (instantiate_decls): Process the saved static chain.
(expand_function_start): If not optimizing, save the static chain
onto the stack.
* tree-nested.c (convert_all_function_calls): Always create the static
chain for nested functions if not optimizing.
From-SVN: r211308
Diffstat (limited to 'gcc/function.c')
-rw-r--r-- | gcc/function.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/function.c b/gcc/function.c index a85ad46..441289e 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -1877,6 +1877,11 @@ instantiate_decls (tree fndecl) } } + /* Process the saved static chain if it exists. */ + decl = DECL_STRUCT_FUNCTION (fndecl)->static_chain_decl; + if (decl && DECL_HAS_VALUE_EXPR_P (decl)) + instantiate_decl_rtl (DECL_RTL (DECL_VALUE_EXPR (decl))); + /* Now process all variables defined in the function or its subblocks. */ instantiate_decls_1 (DECL_INITIAL (fndecl)); @@ -4811,6 +4816,20 @@ expand_function_start (tree subr) if (MEM_P (chain) && reg_mentioned_p (arg_pointer_rtx, XEXP (chain, 0))) set_dst_reg_note (insn, REG_EQUIV, chain, local); + + /* If we aren't optimizing, save the static chain onto the stack. */ + if (!optimize) + { + tree saved_static_chain_decl + = build_decl (DECL_SOURCE_LOCATION (parm), VAR_DECL, + DECL_NAME (parm), TREE_TYPE (parm)); + rtx saved_static_chain_rtx + = assign_stack_local (Pmode, GET_MODE_SIZE (Pmode), 0); + SET_DECL_RTL (saved_static_chain_decl, saved_static_chain_rtx); + emit_move_insn (saved_static_chain_rtx, chain); + SET_DECL_VALUE_EXPR (parm, saved_static_chain_decl); + DECL_HAS_VALUE_EXPR_P (parm) = 1; + } } /* If the function receives a non-local goto, then store the |