On Mon, Jan 20, 2014 at 10:40:31PM +0000, Iyer, Balaji V wrote:
> --- a/gcc/c/c-array-notation.c
> +++ b/gcc/c/c-array-notation.c
> @@ -1218,22 +1218,22 @@ fix_return_expr (tree expr)
>    return new_mod_list;
>  }
>  
> -/* Walks through tree node T and find all the call-statements that do not 
> return
> -   anything and fix up any array notations they may carry.  The return value
> -   is the same type as T but with all array notations replaced with 
> appropriate
> -   STATEMENT_LISTS.  */
> +/* Callback for walk_tree.  Expands all array notations in *TP.  
> *WALK_SUBTREES
> +   is set to 1 unless *TP contains no array notation expressions.  Parameter 
> +   D is unused.  */
>  
> -tree
> -expand_array_notation_exprs (tree t)
> +static tree
> +expand_array_notations (tree *tp, int *walk_subtrees, void *d 
> ATTRIBUTE_UNUSED)

As we are now using C++, just use
expand_array_notations (tree *tp, int *walk_subtrees, void *)
and remove the comment about unused parameter D.

>  {
> -  if (!contains_array_notation_expr (t))
> -    return t;
> +  if (!contains_array_notation_expr (*tp))

Why do you want to walk the whole subtree once more at every level?
That has bad time complexity for very deep trees.
Can't you just do that in expand_array_notations_exprs once?

        Jakub

Reply via email to