public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix PR77931
@ 2016-10-11 12:49 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2016-10-11 12:49 UTC (permalink / raw)
  To: gcc-patches


The following fixes PR77931.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

2016-10-11  Richard Biener  <rguenther@suse.de>

	PR debug/77931
	* gimple-low.c (lower_gimple_bind): Handle arbitrary common
	sub-chains of BLOCK_VARS and gimple_bind_vars.

Index: gcc/gimple-low.c
===================================================================
--- gcc/gimple-low.c	(revision 240963)
+++ gcc/gimple-low.c	(working copy)
@@ -420,18 +420,21 @@ lower_gimple_bind (gimple_stmt_iterator
   /* Scrap DECL_CHAIN up to BLOCK_VARS to ease GC after we no longer
      need gimple_bind_vars.  */
   tree next;
-  tree end = NULL_TREE;
+  /* BLOCK_VARS and gimple_bind_vars share a common sub-chain.  Find
+     it by marking all BLOCK_VARS.  */
   if (gimple_bind_block (stmt))
-    end = BLOCK_VARS (gimple_bind_block (stmt));
-  for (tree var = gimple_bind_vars (stmt); var != end; var = next)
+    for (tree t = BLOCK_VARS (gimple_bind_block (stmt)); t; t = DECL_CHAIN (t))
+      TREE_VISITED (t) = 1;
+  for (tree var = gimple_bind_vars (stmt);
+       var && ! TREE_VISITED (var); var = next)
     {
-      /* Ugh, something is violating the constraint that BLOCK_VARS
-         is a sub-chain of gimple_bind_vars.  */
-      if (! var)
-	break;
       next = DECL_CHAIN (var);
       DECL_CHAIN (var) = NULL_TREE;
     }
+  /* Unmark BLOCK_VARS.  */
+  if (gimple_bind_block (stmt))
+    for (tree t = BLOCK_VARS (gimple_bind_block (stmt)); t; t = DECL_CHAIN (t))
+      TREE_VISITED (t) = 0;
 
   lower_sequence (gimple_bind_body_ptr (stmt), data);
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-10-11 12:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-11 12:49 [PATCH] Fix PR77931 Richard Biener

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).