This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH]: Fix PR debug/19191 and dwarf-die-7.c
On Wed, 2004-12-29 at 19:25 -0800, Richard Henderson wrote:
> On Wed, Dec 29, 2004 at 03:35:57PM -0500, Daniel Berlin wrote:
> > * gimple-low.c (lower_bind_expr): Mark new block used if
> > old block is used.
>
> I guess this is ok.
>
>
> r~
I withdraw this patch, as it is now causing bootstrap failures in
libstdc++ as of today.
Blocks aren't being marked as used by even if they have used variables
in them.
This can be seen with the attached patch.
I'm just going to add a final pass right after remove_useless_vars that
walks the block tree, and sets used properly on all the blocks (based on
whether they have used variables, used subblocks, etc)
Unless someone thinks this is a bad idea/there is a better approach.
--Dan
Index: gimple-low.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gimple-low.c,v
retrieving revision 2.12.2.1
diff -u -p -r2.12.2.1 gimple-low.c
--- gimple-low.c 12 Sep 2004 02:55:48 -0000 2.12.2.1
+++ gimple-low.c 30 Dec 2004 15:36:23 -0000
@@ -209,6 +209,19 @@ lower_stmt (tree_stmt_iterator *tsi, str
tsi_next (tsi);
}
+static void
+verify_used_status (tree block)
+{
+ if (BLOCK_VARS (block))
+ {
+ tree var;
+ for (var = BLOCK_VARS (block); var; var = TREE_CHAIN (var))
+ {
+ if (TREE_USED (var) && !TREE_USED (block))
+ abort ();
+ }
+ }
+}
/* Lowers a bind_expr TSI. DATA is passed through the recursion. */
static void
@@ -233,6 +246,7 @@ lower_bind_expr (tree_stmt_iterator *tsi
/* We do not expect to handle duplicate blocks. */
gcc_assert (!TREE_ASM_WRITTEN (new_block));
TREE_ASM_WRITTEN (new_block) = 1;
+ verify_used_status (new_block);
/* Block tree may get clobbered by inlining. Normally this would
be fixed in rest_of_decl_compilation using block notes, but