This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[tree-ssa] Ignore non-BLOCK subblock trees


Fixes an ICE in the Java gimplifier likely exposed by Jeff Law's unused
vars patch.

For better or worse, gcj reuses BLOCK_SUBBLOCKS for its own purposes:

#define BLOCK_EXPR_BODY(NODE)   BLOCK_SUBBLOCKS(NODE)

Skipping subblocks in find_decl_location is suboptimal but apparently
harmless.  Also find_hidden_use_vars has no effect on Java, which has
no nested functions or VLAs.

(The alternative fix I guess is to normalize BLOCK nodes in
java-gimplify to what trees expect, probably requiring a walk_tree, though
it may eventually be necessary for other reasons.)

Testing in progress.

2003-06-27  Jeff Sturm  <jsturm@one-point.com>

	* tree-dfa.c (find_decl_location): Check TREE_CODE of
	BLOCK_SUBBLOCKS.
	(find_hidden_use_vars): Likewise.

Index: tree-dfa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-dfa.c,v
retrieving revision 1.1.4.124
diff -c -p -r1.1.4.124 tree-dfa.c
*** tree-dfa.c	25 Jun 2003 02:37:31 -0000	1.1.4.124
--- tree-dfa.c	27 Jun 2003 04:02:01 -0000
*************** find_decl_location (tree decl, tree bloc
*** 1962,1968 ****
      if (TREE_CHAIN (d) == decl)
        return &(TREE_CHAIN (d));

!   for (sub = BLOCK_SUBBLOCKS (block); sub; sub = TREE_CHAIN (sub))
      {
        tree *loc = find_decl_location (decl, sub);
        if (loc)
--- 1962,1969 ----
      if (TREE_CHAIN (d) == decl)
        return &(TREE_CHAIN (d));

!   for (sub = BLOCK_SUBBLOCKS (block); sub && TREE_CODE (sub) == BLOCK;
!        sub = TREE_CHAIN (sub))
      {
        tree *loc = find_decl_location (decl, sub);
        if (loc)
*************** find_hidden_use_vars (tree block)
*** 2314,2320 ****
      }

    /* Now repeat the search in any sub-blocks.  */
!   for (sub = BLOCK_SUBBLOCKS (block); sub; sub = TREE_CHAIN (sub))
      find_hidden_use_vars (sub);
  }

--- 2315,2322 ----
      }

    /* Now repeat the search in any sub-blocks.  */
!   for (sub = BLOCK_SUBBLOCKS (block); sub && TREE_CODE (sub) == BLOCK;
!        sub = TREE_CHAIN (sub))
      find_hidden_use_vars (sub);
  }





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]