From 73a23b06358ad97298f638c98c5857aa5cf0427c Mon Sep 17 00:00:00 2001 From: "Balaji V. Iyer" Date: Wed, 12 Jun 2013 22:03:20 +0000 Subject: fix pr c/57577 fix pr c/57577 gcc/c/ChangeLog +2013-06-12 Balaji V. Iyer + + * c-array-notation.c (build_array_notation_expr): Reject array notation + mismatch between LHS and RHS even inside a call_expr. Also, removed + a couple while statements that were dead code. + gcc/testsuite/ChangeLog +2013-06-12 Balaji V. Iyer + + PR c/57577 + * c-c++-common/cilk-plus/AN/pr57577.c: New testcase. + From-SVN: r200043 --- gcc/c/c-array-notation.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'gcc/c/c-array-notation.c') diff --git a/gcc/c/c-array-notation.c b/gcc/c/c-array-notation.c index 3285969..03b66b9 100644 --- a/gcc/c/c-array-notation.c +++ b/gcc/c/c-array-notation.c @@ -781,7 +781,7 @@ build_array_notation_expr (location_t location, tree lhs, tree lhs_origtype, rhs_list_size = vec_safe_length (rhs_list); lhs_list_size = vec_safe_length (lhs_list); - if (lhs_rank == 0 && rhs_rank != 0 && TREE_CODE (rhs) != CALL_EXPR) + if (lhs_rank == 0 && rhs_rank != 0) { tree rhs_base = rhs; if (TREE_CODE (rhs_base) == ARRAY_NOTATION_REF) @@ -802,17 +802,6 @@ build_array_notation_expr (location_t location, tree lhs, tree lhs_origtype, } if (lhs_rank != 0 && rhs_rank != 0 && lhs_rank != rhs_rank) { - tree lhs_base = lhs; - tree rhs_base = rhs; - - for (ii = 0; ii < lhs_rank; ii++) - lhs_base = ARRAY_NOTATION_ARRAY (lhs_base); - - while (rhs_base && TREE_CODE (rhs_base) != ARRAY_NOTATION_REF) - rhs_base = TREE_OPERAND (rhs_base, 0); - for (ii = 0; ii < rhs_rank; ii++) - rhs_base = ARRAY_NOTATION_ARRAY (rhs_base); - error_at (location, "rank mismatch between %qE and %qE", lhs, rhs); pop_stmt_list (an_init); return error_mark_node; -- cgit v1.1