]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gimplify_modify_expr: avoid DECL_DEBUG_EXPR links across functions
authorPierre-Marie de Rodat <derodat@adacore.com>
Tue, 30 May 2017 15:34:00 +0000 (15:34 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Tue, 30 May 2017 15:34:00 +0000 (15:34 +0000)
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

gcc/ChangeLog
gcc/gimplify.c

index 2db6af3639bc92fcb404db5a17456aea94e6c948..9da74328dcf8b270f4681560df541f1e5ead4912 100644 (file)
@@ -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.
index 455a6993e15feda1fbb7a758341d22b5ed8cb70d..2c7fc9fabd14cfbdfa0c8c8767fe64e05a8a2b4c 100644 (file)
@@ -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)