From 723f8a7998b9e9e2acc9bf5e75511729ae945572 Mon Sep 17 00:00:00 2001 From: rguenth Date: Tue, 11 Oct 2016 12:52:44 +0000 Subject: [PATCH] 2016-10-11 Richard Biener PR debug/77931 * gimple-low.c (lower_gimple_bind): Handle arbitrary common sub-chains of BLOCK_VARS and gimple_bind_vars. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@240991 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/gimple-low.c | 17 ++++++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1a9cb5ac003..03c5fa570ef 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-10-11 Richard Biener + + PR debug/77931 + * gimple-low.c (lower_gimple_bind): Handle arbitrary common + sub-chains of BLOCK_VARS and gimple_bind_vars. + 2016-10-11 Venkataramanan Kumar * config/i386/znver1.md : Fix imov/imovx load type reservations. diff --git a/gcc/gimple-low.c b/gcc/gimple-low.c index 8e98762e6fd..64752b67b86 100644 --- a/gcc/gimple-low.c +++ b/gcc/gimple-low.c @@ -420,18 +420,21 @@ lower_gimple_bind (gimple_stmt_iterator *gsi, struct lower_data *data) /* 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); -- 2.11.4.GIT