aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPierre-Marie de Rodat <derodat@adacore.com>2017-05-30 15:34:00 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2017-05-30 15:34:00 +0000
commit0a37d40c9ceee7b502a06214037346884debf4e6 (patch)
treef1761d3932477acc359771d0b1794dacbd2457af /gcc
parente2f353338584c197e7d62370821fe48f76a52ce8 (diff)
downloadgcc-0a37d40c9ceee7b502a06214037346884debf4e6.zip
gcc-0a37d40c9ceee7b502a06214037346884debf4e6.tar.gz
gcc-0a37d40c9ceee7b502a06214037346884debf4e6.tar.bz2
gimplify_modify_expr: avoid DECL_DEBUG_EXPR links across functions
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. gcc/ * gimplify.c (gimplify_modify_expr): Don't create a DECL_DEBUG_EXPR link if *FROM_P does not belong to the current function. From-SVN: r248688
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/gimplify.c3
2 files changed, 8 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2db6af3..9da7432 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2017-05-30 Pierre-Marie de Rodat <derodat@adacore.com>
+
+ * gimplify.c (gimplify_modify_expr): Don't create a
+ DECL_DEBUG_EXPR link if *FROM_P does not belong to the current
+ function.
+
2017-05-30 Wilco Dijkstra <wdijkstr@arm.com>
* config/arm/arm-builtins.c (arm_expand_builtin): Remove const.
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 455a699..2c7fc9f 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)