]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix logic bug in Cilk Plus array expansion
authorPatrick Palka <ppalka@gcc.gnu.org>
Sat, 16 Jan 2016 02:30:14 +0000 (02:30 +0000)
committerPatrick Palka <ppalka@gcc.gnu.org>
Sat, 16 Jan 2016 02:30:14 +0000 (02:30 +0000)
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.

gcc/testsuite/ChangeLog:

* c-c++-common/cilk-plus/AN/an-if.c: Check that the original
dump does not contain an error_mark_node.
* c-c++-common/cilk-plus/CK/pr60469.c: Likewise.
* c-c++-common/cilk-plus/AN/fn_ptr-2.c: New xfail'd test.

From-SVN: r232462

gcc/cp/ChangeLog
gcc/cp/cp-array-notation.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/cilk-plus/AN/an-if.c
gcc/testsuite/c-c++-common/cilk-plus/AN/fn_ptr-2.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/cilk-plus/CK/pr60469.c

index fbf8064fc9ac440e57788238b3a1d4b1e6e0f3ea..91b92a8b82cf28d48da6b55e53f0ebb4cd3d0290 100644 (file)
@@ -1,3 +1,9 @@
+2016-01-16  Patrick Palka  <ppalka@gcc.gnu.org>
+
+       * cp-array-notation.c (cp_expand_cond_array_notations): Return
+       error_mark_node only if find_rank failed, not if it was
+       successful.
+
 2016-01-16  Patrick Palka  <ppalka@gcc.gnu.org>
 
        PR c++/68936
index f7a459857982684dd618d952635fab44484ec2a9..4687ced6729c13fd2c64a808c3ffc6dc3fe3993f 100644 (file)
@@ -807,8 +807,8 @@ cp_expand_cond_array_notations (tree orig_stmt)
       if (!find_rank (EXPR_LOCATION (cond), cond, cond, true, &cond_rank)
          || !find_rank (EXPR_LOCATION (yes_expr), yes_expr, yes_expr, true,
                         &yes_rank)
-         || find_rank (EXPR_LOCATION (no_expr), no_expr, no_expr, true,
-                       &no_rank))
+         || !find_rank (EXPR_LOCATION (no_expr), no_expr, no_expr, true,
+                        &no_rank))
        return error_mark_node;
       /* If the condition has a zero rank, then handle array notations in body
         separately.  */
index 600329af803235cc791deab1b000925f48e79c48..e21aad44ca6b131a43f4ce356cbf11cef2fdbc36 100644 (file)
@@ -1,3 +1,10 @@
+2016-01-16  Patrick Palka  <ppalka@gcc.gnu.org>
+
+       * c-c++-common/cilk-plus/AN/an-if.c: Check that the original
+       dump does not contain an error_mark_node.
+       * c-c++-common/cilk-plus/CK/pr60469.c: Likewise.
+       * c-c++-common/cilk-plus/AN/fn_ptr-2.c: New xfail'd test.
+
 2016-01-16  Patrick Palka  <ppalka@gcc.gnu.org>
 
        PR c++/68936
index 4bf85b5ca9393f500051082b4518ffbc6daee10b..4ac46abc4048133d5dab7572d484bbb8b80dc58a 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do run } */
-/* { dg-options "-fcilkplus" } */
+/* { dg-options "-fcilkplus -fdump-tree-original" } */
 
 #if HAVE_IO
 #include <stdio.h>
@@ -46,3 +46,6 @@ int main() {
     }
     return 0;
 }
+
+/* The C++ FE once emitted a bogus error_mark_node for this test case.  */
+/* { dg-final { scan-tree-dump-not "<<< error >>>" "original" } } */
diff --git a/gcc/testsuite/c-c++-common/cilk-plus/AN/fn_ptr-2.c b/gcc/testsuite/c-c++-common/cilk-plus/AN/fn_ptr-2.c
new file mode 100644 (file)
index 0000000..4e1990f
--- /dev/null
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+
+typedef void (*f) (void *);
+f b[1024];
+void *c[1024][1024];
+
+int
+main (void)
+{
+  (b[:]) (c[:][:]); /* { dg-error "rank mismatch" "" { xfail *-*-* } } */
+  return 0;
+}
+
index ca0cf7f68bc7616f13b934d5046f0bd50dea87aa..670df17faa2c56b5268e5c05b2accd9453a78287 100644 (file)
@@ -1,6 +1,6 @@
 /* PR middle-end/60469 */
 /* { dg-do compile } */
-/* { dg-options "-fcilkplus" } */
+/* { dg-options "-fcilkplus -fdump-tree-original" } */
 
 void foo() {}
 
@@ -13,3 +13,6 @@ int main(int argc, char* argv[])
   _Cilk_spawn foo();
   return 0;
 }
+
+/* The C++ FE once emitted a bogus error_mark_node for this test case.  */
+/* { dg-final { scan-tree-dump-not "<<< error >>>" "original" } } */