From 73a23b06358ad97298f638c98c5857aa5cf0427c Mon Sep 17 00:00:00 2001 From: "Balaji V. Iyer" Date: Wed, 12 Jun 2013 22:03:20 +0000 Subject: [PATCH] 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/ChangeLog | 6 ++++++ gcc/c/c-array-notation.c | 13 +------------ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/c-c++-common/cilk-plus/AN/pr57577.c | 11 +++++++++++ 4 files changed, 23 insertions(+), 12 deletions(-) create mode 100644 gcc/testsuite/c-c++-common/cilk-plus/AN/pr57577.c diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 72d182bbae3f..6179c3bb5465 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,9 @@ +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. + 2013-06-10 Balaji V. Iyer * c-array-notation.c (fix_builtin_array_notation_fn): Fully folded diff --git a/gcc/c/c-array-notation.c b/gcc/c/c-array-notation.c index 32859691cc32..03b66b9cf794 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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b167e4c3d479..5c45e1a20a97 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-06-12 Balaji V. Iyer + + PR c/57577 + * c-c++-common/cilk-plus/AN/pr57577.c: New testcase. + 2013-06-12 Paolo Carlini PR c++/38958 diff --git a/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57577.c b/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57577.c new file mode 100644 index 000000000000..fb3490efa822 --- /dev/null +++ b/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57577.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-fcilkplus" } */ + +int A[10], B[10][10]; +int foo (int a); + +int main () { + A[:] = foo (B[:][:]); /* { dg-error "rank mismatch between" } */ + A[0] = foo (B[:][:]); /* { dg-error "cannot be scalar when" } */ + return 0; +} -- 2.43.5