public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 1/2] gimplify_modify_expr: avoid DECL_DEBUG_EXPR links across functions
@ 2017-05-29  7:50 Pierre-Marie de Rodat
  2017-05-29  8:05 ` [PATCH 2/2] DWARF: make it possible to emit debug info for declarations only Pierre-Marie de Rodat
  2017-05-30 11:59 ` [PATCH 1/2] gimplify_modify_expr: avoid DECL_DEBUG_EXPR links across functions Richard Biener
  0 siblings, 2 replies; 14+ messages in thread
From: Pierre-Marie de Rodat @ 2017-05-29  7:50 UTC (permalink / raw)
  To: gcc-patches; +Cc: Pierre-Marie de Rodat

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2017-06-21 11:25 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-29  7:50 [PATCH 1/2] gimplify_modify_expr: avoid DECL_DEBUG_EXPR links across functions Pierre-Marie de Rodat
2017-05-29  8:05 ` [PATCH 2/2] DWARF: make it possible to emit debug info for declarations only Pierre-Marie de Rodat
2017-05-29 13:39   ` Pierre-Marie de Rodat
2017-05-30 12:11   ` Richard Biener
2017-05-30 15:51     ` Pierre-Marie de Rodat
2017-05-31  7:37       ` Richard Biener
2017-05-31  9:12         ` Pierre-Marie de Rodat
2017-06-16 16:35           ` Pierre-Marie de Rodat
2017-06-20 12:16             ` Richard Biener
2017-06-20 14:34               ` Pierre-Marie de Rodat
2017-06-21  7:11                 ` Richard Biener
2017-06-21 11:25                   ` Pierre-Marie de Rodat
2017-05-30 11:59 ` [PATCH 1/2] gimplify_modify_expr: avoid DECL_DEBUG_EXPR links across functions Richard Biener
2017-05-30 15:35   ` Pierre-Marie de Rodat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).