1/* { dg-do compile } */
2/* { dg-options "-fcilkplus" } */
3
4int main (void)
5{
6  int array[10], array2[10][10];
7  int x, ii, jj ;
8
9  switch (array[:]) {  /* { dg-error "cannot be used as a condition for switch statement" } */
10  case 1:
11    x = 5;
12    break;
13  case 2:
14    x = 2;
15    break;
16  default:
17    x = 9;
18  }
19
20  switch (array2[:][:]) { /* { dg-error "cannot be used as a condition for switch statement" } */
21  case 1:
22    x = 5;
23    break;
24  case 2:
25    x = 2;
26    break;
27  default:
28    x = 9;
29  }
30
31  switch (array[:] + x) { /* { dg-error "cannot be used as a condition for switch statement" } */
32  case 1:
33    x = 5;
34    break;
35  case 2:
36    x = 2;
37    break;
38  default:
39    x = 9;
40  }
41
42  switch (array2[:][1:x:4] + x) { /* { dg-error "cannot be used as a condition for switch statement" } */
43  case 1:
44    x = 5;
45    break;
46  case 2:
47    x = 2;
48    break;
49  default:
50    x = 9;
51  }
52
53  for (ii = 0; ii < array[:]; ii++) /* { dg-error "cannot be used in a condition for a for-loop" } */
54    {
55      x = 2;
56    }
57
58  for (ii = 0; ii < array2[:][:]; ii++) /* { dg-error "cannot be used in a condition for a for-loop" } */
59    {
60      x = 3;
61    }
62
63  for (; array2[:][:] < 2;) /* { dg-error "cannot be used in a condition for a for-loop" } */
64    x = 4;
65
66
67  while (array2[:][:]) /* { dg-error "cannot be used as a condition for while statement" } */
68    x = 3;
69
70  while (array[1:1:1]) /* { dg-error "cannot be used as a condition for while statement" } */
71    x = 1;
72
73  while (ii != array2[1:x:3][1:2:1]) /* { dg-error "cannot be used as a condition for while statement"  } */
74    x = 2;
75
76  do {
77    x = 3;
78  } while (ii != array2[:][:]); /* { dg-error "cannot be used as a condition for a do-while statement" } */
79
80  do {
81    x = 2;
82  } while (ii != (x + array2[:][1:x:2]) + 2); /* { dg-error "cannot be used as a condition for a do-while statement" } */
83
84  do {
85    x += 3;
86    if (x == 5)
87      return array2[:][:]; /* { dg-error "array notation expression cannot be used as a return value" } */
88  } while (ii != 0);
89
90  for (ii = 0;  ii < 10; ii++)
91    if (ii % 2)
92      return array[1:x:ii]; /* { dg-error "array notation expression cannot be used as a return value" } */
93
94  for (ii = 0; ii < x; ii++)
95    if (ii)
96      return array2[:][:]; /* { dg-error "array notation expression cannot be used as a return value" } */
97
98  for (array[:] = 0; ii < x; ii++) /* This should be OK.  */
99    x= 2;
100
101  for (ii = 0; ii < 10; array[:]++) /* This is OK.  */
102    x = 5;
103
104  for (jj = 0; jj < 10; array2[:][:]++) /* This is OK.  */
105    x = 3;
106
107  for (jj = 0; jj < 10; array2[:][1:x:4]++, jj++) /* This is OK.  */
108    x = 3;
109
110  return x;
111}
112
113