Commit 73a23b06 by Balaji V. Iyer Committed by Balaji V. Iyer

fix pr c/57577

fix pr c/57577
gcc/c/ChangeLog
+2013-06-12  Balaji V. Iyer  <balaji.v.iyer@intel.com>
+
+       * 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  <balaji.v.iyer@intel.com>
+
+       PR c/57577
+       * c-c++-common/cilk-plus/AN/pr57577.c: New testcase.
+

From-SVN: r200043
parent 6a026364
2013-06-12 Balaji V. Iyer <balaji.v.iyer@intel.com>
* 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 <balaji.v.iyer@intel.com> 2013-06-10 Balaji V. Iyer <balaji.v.iyer@intel.com>
* c-array-notation.c (fix_builtin_array_notation_fn): Fully folded * c-array-notation.c (fix_builtin_array_notation_fn): Fully folded
......
...@@ -781,7 +781,7 @@ build_array_notation_expr (location_t location, tree lhs, tree lhs_origtype, ...@@ -781,7 +781,7 @@ build_array_notation_expr (location_t location, tree lhs, tree lhs_origtype,
rhs_list_size = vec_safe_length (rhs_list); rhs_list_size = vec_safe_length (rhs_list);
lhs_list_size = vec_safe_length (lhs_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; tree rhs_base = rhs;
if (TREE_CODE (rhs_base) == ARRAY_NOTATION_REF) if (TREE_CODE (rhs_base) == ARRAY_NOTATION_REF)
...@@ -802,17 +802,6 @@ build_array_notation_expr (location_t location, tree lhs, tree lhs_origtype, ...@@ -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) 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); error_at (location, "rank mismatch between %qE and %qE", lhs, rhs);
pop_stmt_list (an_init); pop_stmt_list (an_init);
return error_mark_node; return error_mark_node;
......
2013-06-12 Balaji V. Iyer <balaji.v.iyer@intel.com>
PR c/57577
* c-c++-common/cilk-plus/AN/pr57577.c: New testcase.
2013-06-12 Paolo Carlini <paolo.carlini@oracle.com> 2013-06-12 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/38958 PR c++/38958
......
/* { 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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment