This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 1/2] gimplify_modify_expr: avoid DECL_DEBUG_EXPR links across functions
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Pierre-Marie de Rodat <derodat at adacore dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 30 May 2017 13:51:33 +0200
- Subject: Re: [PATCH 1/2] gimplify_modify_expr: avoid DECL_DEBUG_EXPR links across functions
- Authentication-results: sourceware.org; auth=none
- References: <20170529075011.15538-1-derodat@adacore.com>
On Mon, May 29, 2017 at 9:50 AM, Pierre-Marie de Rodat
<derodat@adacore.com> wrote:
> Hello,
>
> An upcoming patch exposes a bug in gimplify_modify_expr. There, we try
> not to create DECL_DEBUG_EXPR links across functions, however we don't
> check that *FROM_P actually belongs to the current function before
> modifying it. This patch fixes this oversight.
>
> Bootstrapped and regtested on x86_64-linux. Ok to commit? Thank you in
> advance!
Ok.
Richard.
> gcc/
>
> * gimplify.c (gimplify_modify_expr): Don't create a
> DECL_DEBUG_EXPR link if *FROM_P does not belong to the current
> function.
> ---
> gcc/gimplify.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/gimplify.c b/gcc/gimplify.c
> index 455a6993e15..2c7fc9fabd1 100644
> --- a/gcc/gimplify.c
> +++ b/gcc/gimplify.c
> @@ -5580,7 +5580,8 @@ gimplify_modify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
> && DECL_IGNORED_P (*from_p)
> && DECL_P (*to_p)
> && !DECL_IGNORED_P (*to_p)
> - && decl_function_context (*to_p) == current_function_decl)
> + && decl_function_context (*to_p) == current_function_decl
> + && decl_function_context (*from_p) == current_function_decl)
> {
> if (!DECL_NAME (*from_p) && DECL_NAME (*to_p))
> DECL_NAME (*from_p)
> --
> 2.13.0
>