This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH 3/5] Add test cases for all the new cilk errors
- From: Andi Kleen <andi at firstfloor dot org>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Andi Kleen <ak at linux dot intel dot com>
- Date: Wed, 1 Oct 2014 21:26:56 -0700
- Subject: [PATCH 3/5] Add test cases for all the new cilk errors
- Authentication-results: sourceware.org; auth=none
- References: <1412224018-25368-1-git-send-email-andi at firstfloor dot org> <1412224018-25368-2-git-send-email-andi at firstfloor dot org>
From: Andi Kleen <ak@linux.intel.com>
gcc/testsuite/:
2014-09-30 Andi Kleen <ak@linux.intel.com>
* c-c++-common/cilk-plus/CK/errors.c: New test.
---
gcc/testsuite/c-c++-common/cilk-plus/CK/errors.c | 56 ++++++++++++++++++++++++
1 file changed, 56 insertions(+)
create mode 100644 gcc/testsuite/c-c++-common/cilk-plus/CK/errors.c
diff --git a/gcc/testsuite/c-c++-common/cilk-plus/CK/errors.c b/gcc/testsuite/c-c++-common/cilk-plus/CK/errors.c
new file mode 100644
index 0000000..ca2032c
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cilk-plus/CK/errors.c
@@ -0,0 +1,56 @@
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+
+int func_2(void);
+
+int check_spawn(int v)
+{
+ if (_Cilk_spawn func_2()) /* { dg-error "cannot contain" "" { target c } } */
+ /* XXX: no error in C++ */
+ ;
+ if (v + _Cilk_spawn func_2()) /* { dg-error "cannot contain" "" { target c } } */
+ /* { dg-error "invalid use" "" { target c++ } 11 } */
+ ;
+ if (v, _Cilk_spawn func_2()) /* { dg-error "spawned function call cannot be part" } */
+ ;
+ v, _Cilk_spawn func_2(); /* { dg-error "spawned function call cannot be part" } */
+ while (_Cilk_spawn func_2()) /* { dg-error "a condition for while statement" } */
+ ;
+ while (v + _Cilk_spawn func_2()) /* { dg-error "a condition for while statement" } */
+ ;
+ for (; _Cilk_spawn func_2() ;) /* { dg-error "cannot be used" } */
+ ;
+ for (; v + _Cilk_spawn func_2() ;) /* { dg-error "cannot be used" } */
+ ;
+ v + _Cilk_spawn func_2(); /* { dg-error } */
+ for (_Cilk_spawn func_2() ;;)
+ ;
+ for (;; _Cilk_spawn func_2())
+ ;
+ do {} while(_Cilk_spawn func_2()); /* { dg-error "cannot be used" } */
+ do {} while(v + _Cilk_spawn func_2()); /* { dg-error "cannot be used" } */
+ switch (_Cilk_spawn func_2()) /* { dg-error "cannot be used" } */
+ {
+ default: break;
+ }
+ goto *(_Cilk_spawn func_2()); /* { dg-error "cannot be used" } */
+
+ return _Cilk_spawn func_2(); /* { dg-error "is not allowed" } */
+}
+
+int check_array_notation(int x[100], int y[100])
+{
+ x[0:100] = y[0:100];
+ for (; x[0:100] = y[0:100]; ) /* { dg-error "cannot be used" } */
+ ;
+ while (x[0:100] = y[0:100]) /* { dg-error "cannot be used" } */
+ ;
+ switch (x[0:100] = y[0:100]) /* { dg-error "cannot be used" } */
+ {
+ default: break;
+ }
+ do {} while (x[0:100] = y[0:100]); /* { dg-error "cannot be used" } */
+ if (x[0:100] = y[0:100]) /* allowed */
+ ;
+ return x[0:100] = y[0:100]; /* { dg-error "cannot be used" } */
+}
--
2.1.1