On Fri, Jan 01, 2016 at 10:06:34PM -0700, Jeff Law wrote:
> >gcc/cp/ChangeLog:
> >
> >     * cp-array-notation.c (cp_expand_cond_array_notations): Return
> >     error_mark_node only if find_rank failed, not if it was
> >     successful.
> Can you use -fdump-tree-original in the testcase and verify there's no <<<
> error >>> expressions in the resulting dump file?
> 
> With that change, this is OK.

I think the patch is incomplete.  Because, find_rank does not always emit
an error if it returns false, so we again have cases where we can get
error_mark_node in the code without error being emitted.
      else if (*rank != current_rank)
        {
          /* In this case, find rank is being recursed through a set of
             expression of the form A <OPERATION> B, where A and B both have
             array notations in them and the rank of A is not equal to rank of 
B.
             A simple example of such case is the following: X[:] + Y[:][:] */
          *rank = current_rank;
          return false;
        }
and other spots.  E.g.
                  if (prev_arg && EXPR_HAS_LOCATION (prev_arg))
                    error_at (EXPR_LOCATION (prev_arg),
                              "rank mismatch between %qE and %qE", prev_arg,
                              TREE_OPERAND (expr, ii));
looks very suspicious.

        Jakub

Reply via email to