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! 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