(C++) patch to walk_tree

Jason Merrill jason@redhat.com
Fri Oct 20 14:23:00 GMT 2000


Fixes g++.other/inline15.C.  Several helpers used with walk_tree use
various hacks to avoid recursing into default args, but it seems to me
that it is actually wrong for all of the uses of walk_tree, so we
should avoid it in walk_tree itself.

Code like that in simplify_aggr_init_exprs_r to avoid recursing into
types may still be useful for performance reasons, but this patch
should avoid requiring that sort of thing for correctness.

2000-10-20  Jason Merrill  <jason@redhat.com>

	* tree.c (walk_tree): Don't walk into default args.

*** tree.c.~1~	Thu Sep 21 18:01:50 2000
--- tree.c	Fri Oct 20 16:37:12 2000
*************** walk_tree (tp, func, data, htab)
*** 1388,1394 ****
  
      case FUNCTION_TYPE:
        WALK_SUBTREE (TREE_TYPE (*tp));
!       WALK_SUBTREE (TYPE_ARG_TYPES (*tp));
        break;
  
      case ARRAY_TYPE:
--- 1388,1400 ----
  
      case FUNCTION_TYPE:
        WALK_SUBTREE (TREE_TYPE (*tp));
!       {
! 	tree arg = TYPE_ARG_TYPES (*tp);
! 
! 	/* We never want to walk into default arguments.  */
! 	for (; arg; arg = TREE_CHAIN (arg))
! 	  WALK_SUBTREE (TREE_VALUE (arg));
!       }
        break;
  
      case ARRAY_TYPE:


More information about the Gcc-patches mailing list