aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/SE/vlength_errors.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/SE/vlength_errors.c')
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/SE/vlength_errors.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/SE/vlength_errors.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/SE/vlength_errors.c
new file mode 100644
index 000000000..1bcf2a27a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/SE/vlength_errors.c
@@ -0,0 +1,59 @@
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus -Wunknown-pragmas" } */
+
+#define Q 4
+
+int z = Q;
+
+__attribute__ ((vector (uniform(x), vectorlength (), linear (y:1) ))) /* { dg-error "expected expression" "" { target c } } */
+ /* { dg-error "expected primary-expression" "" { target c++ } 8 } */
+int func2 (int x, int y)
+{
+ int zq = 5;
+ return x + (y*zq);
+}
+
+__attribute__ ((vector (uniform(x), linear (y:1), vectorlength (4.5) ))) /* { dg-error "vectorlength must be an integer" } */
+int func3 (int x, int y)
+{
+ int zq = 5;
+ return x + (y*zq);
+}
+
+__attribute__ ((vector (uniform(x), linear (y:1), vectorlength (z) ))) /* { dg-error "vectorlength must be an integer" "" { target c } } */
+ /* { dg-error "constant" "" { target c++ } 23 } */
+int func4 (int x, int y)
+{
+ int zq = 5;
+ return x + (y*zq);
+}
+
+__attribute__ ((vector (uniform(x), linear (y:1), vectorlength (Q) ))) /* This is OK! */
+int func5 (int x, int y)
+{
+ int zq = 5;
+ return x + (y*zq);
+}
+
+__attribute__ ((vector (uniform(x), vectorlength (z), linear (y:1)))) /* { dg-error "vectorlength must be an integer" "" { target c } } */
+ /* { dg-error "constant" "" { target c++ } 38 } */
+int func6 (int x, int y)
+{
+ int zq = 5;
+ return x + (y*zq);
+}
+
+__attribute__ ((vector (uniform(x), linear (y:1), vectorlength (sizeof (int)) ))) /* This is OK too! */
+int func7 (int x, int y)
+{
+ int zq = 5;
+ return x + (y*zq);
+}
+
+int main (void)
+{
+ int ii = 0, q = 5;
+ for (ii = 0; ii < 10; ii++)
+ q += func2 (z, ii);
+ return q;
+}