aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Palka <ppalka@gcc.gnu.org>2016-01-16 02:30:14 +0000
committerPatrick Palka <ppalka@gcc.gnu.org>2016-01-16 02:30:14 +0000
commit203484bb27d092dde0f91bf50ce6bc541f1e5dfe (patch)
treef5d75ff6dd39696c86933b9753178c8ba2b7bb77
parentaa2500e9bc6ce022c604fefb5f9c60d6fd7134f8 (diff)
downloadgcc-203484bb27d092dde0f91bf50ce6bc541f1e5dfe.zip
gcc-203484bb27d092dde0f91bf50ce6bc541f1e5dfe.tar.gz
gcc-203484bb27d092dde0f91bf50ce6bc541f1e5dfe.tar.bz2
Fix logic bug in Cilk Plus array expansion
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
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/cp-array-notation.c4
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/c-c++-common/cilk-plus/AN/an-if.c5
-rw-r--r--gcc/testsuite/c-c++-common/cilk-plus/AN/fn_ptr-2.c14
-rw-r--r--gcc/testsuite/c-c++-common/cilk-plus/CK/pr60469.c5
6 files changed, 37 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index fbf8064..91b92a8 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,11 @@
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
* tree.c (build_min_non_dep_call_vec): Don't retain the
KOENIG_LOOKUP_P flag of the non-dependent expression that's
diff --git a/gcc/cp/cp-array-notation.c b/gcc/cp/cp-array-notation.c
index f7a4598..4687ced6 100644
--- a/gcc/cp/cp-array-notation.c
+++ b/gcc/cp/cp-array-notation.c
@@ -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. */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 600329a..e21aad4 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,12 @@
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
* g++.dg/template/pr68936.C: New test.
diff --git a/gcc/testsuite/c-c++-common/cilk-plus/AN/an-if.c b/gcc/testsuite/c-c++-common/cilk-plus/AN/an-if.c
index 4bf85b5..4ac46ab 100644
--- a/gcc/testsuite/c-c++-common/cilk-plus/AN/an-if.c
+++ b/gcc/testsuite/c-c++-common/cilk-plus/AN/an-if.c
@@ -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
index 0000000..4e1990f
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cilk-plus/AN/fn_ptr-2.c
@@ -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;
+}
+
diff --git a/gcc/testsuite/c-c++-common/cilk-plus/CK/pr60469.c b/gcc/testsuite/c-c++-common/cilk-plus/CK/pr60469.c
index ca0cf7f..670df17 100644
--- a/gcc/testsuite/c-c++-common/cilk-plus/CK/pr60469.c
+++ b/gcc/testsuite/c-c++-common/cilk-plus/CK/pr60469.c
@@ -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" } } */