[PATCH] Cilk Plus Array Notation for C++

Jason Merrill jason@redhat.com
Fri Jun 28 13:43:00 GMT 2013


On 06/28/2013 12:54 AM, Iyer, Balaji V wrote:
> I agree with you and I have fixed it such that if TREE_TYPE is void then don't bother creating a new variable.
>
> This error happens in comma_exp.c testcase in Mac.
> For example, the following expression:
>
>    array[:]  = (atoi(argv[1]), (array2[0:10]+5));
>
> In Mac, it is converting the above expression to array[:] = ((void) atoi (argv[1]), (array2[0:10]+5))
>
> There is a function (replace_invariant_exprs) that will go through all the invariant expressions and replace it with a variable so that the function is only evaluated once. In this case, there is no reason to do so and just ignore it.

We don't need to create a variable, but if the expression has 
side-effects I think we still want to move it out of the loop, right? 
The Cilk+ spec doesn't seem to specify whether subexpressions of rank 0 
are evaluated once per iteration, or just once total.

> +         /* Sometimes, when comma_expr has a function call in it, it will
> +            typecast it to void.  Find_inv_trees finds those nodes and so
> +            if it void type, then don't bother creating a new var to hold
> +            the return value.   */
> +         if (VOID_TYPE_P (TREE_TYPE (t)))
> +           new_var = t;
> +         else
> +           new_var = get_temp_regvar (TREE_TYPE (t), t);

I was suggesting

if (VOID_TYPE_P (TREE_TYPE (t)))
   {
     finish_expr_stmt (t);
     new_var = void_zero_node;
   }

Jason



More information about the Gcc-patches mailing list