On Wed, Jan 15, 2014 at 10:37:04PM +0000, Iyer, Balaji V wrote:
> Hello Everyone,
> Attached, please find a patch that will fix PR 59825. The main issue was
> array notations occurring in COMPOUND_EXPR. This patch should fix that
> and fix the rank_mismatch2.c test-case ICE.
> --- a/gcc/c/c-array-notation.c
> +++ b/gcc/c/c-array-notation.c
> @@ -1289,6 +1289,15 @@ expand_array_notation_exprs (tree t)
> A[x:y];
> Replace those with just void zero node. */
> t = void_zero_node;
> + return t;
> + case COMPOUND_EXPR:
> + if (contains_array_notation_expr (t))
> + if (TREE_CODE (TREE_OPERAND (t, 0)) == SAVE_EXPR)
> + {
> + t = expand_array_notation_exprs (TREE_OPERAND (t, 1));
> + return t;
> + }
> + /* Else fall through. */
> default:
> for (int ii = 0; ii < TREE_CODE_LENGTH (TREE_CODE (t)); ii++)
> if (contains_array_notation_expr (TREE_OPERAND (t, ii)))
Why doesn't the default case handle it? Furthermore, you are removing
the COMPOUND_EXPR and the SAVE_EXPR from the first operand of the
COMPOUND_EXPR, that reverts the effects of the fix if there are
array notations anywhere.
And last comment to the expand_array_notation_exprs, especially the C++ one,
wouldn't it be better to rewrite them as walk_tree/cp_walk_tree callbacks,
so that it really handles all expressions, not just a small subset of them?
E.g. in C++ you just don't look at all about OMP_PARALLEL etc., so I'd
expect you ICE if array notation is found inside of #pragma omp parallel
body.
Jakub