comparison gcc/testsuite/c-c++-common/cilk-plus/AN/if_test_errors.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 /* { dg-do compile } */
2 /* { dg-options "-fcilkplus" } */
3
4 #include <stdlib.h>
5 int main (void)
6 {
7 int x = 3, y, z, array[10], array2[10], TwodArray[10][10], jj,kk,ll ;
8 int array2_check[10], array2d_check[10][10], array2d[10][10];
9 int FourDArray[10][10][10][10], array4[10][10][10][10];
10 int array4_check[10][10][10][10];
11 int ii = 0;
12
13 x = 5;
14 y = 10;
15 z = 2;
16
17 if (!array[:]) /* This is OK! */
18 array2[:] = 5;
19 else
20 array2[:] = 10;
21 if (!(array[0:10:1] + array[0:10:1])) /* { dg-error "condition and the then-block" "" { target c } } */
22 array2d[:][:] = 5; /* { dg-error "rank mismatch with controlling expression of parent" "" { target c++ } } */
23 else
24 array2[:] = 10;
25
26 if (!(array[0:10:1] + array[0:10:1])) /* { dg-error "condition and the else-block" "" { target c } } */
27 array2[:] = 5;
28 else
29 array2d[:][:] = 10; /* { dg-error "rank mismatch with controlling expression of parent" "" { target c++ } } */
30
31
32 if (TwodArray[:][:] != 10) /* { dg-error "condition and the then-block" "" { target c } } */
33 array2[:] = 10; /* { dg-error "rank mismatch with controlling expression of parent" "" { target c++ } } */
34 else
35 array2[:] = 5;
36
37 if (FourDArray[43][:][:][:] != 10) /* This is OK! */
38 array4[45][:][:][:] = 10;
39 else
40 array4[32][:][:][:] = 5;
41
42 /* atoi(argv[1]) == 10, so it will convert all 10's to 5's */
43 if (FourDArray[42][0:10:1][9:10:-1][0:5:2] != 10) /* { dg-error "condition and the then-block" "" { target c } } */
44 array4[0:10:1][0:5:2][9:10:-1][0:5:2] = 10; /* { dg-error "rank mismatch with controlling expression of parent" "" { target c++ } } */
45 else
46 array4[0:10:1][0:5:2][9:10:-1][0:5:2] = 5;
47
48 /* atoi(argv[1]) == 10, so it will convert all 10's to 5's */
49 if (FourDArray[0:10:1][0:5:2][9:10:-1][x:y:z] +
50 FourDArray[0:10:1][0:5:2][9:-10:1][x:y:z] != 20)
51 array4[0:10:1][0:5:2][9:10:-1][x:y:z] = 10;
52 else
53 array4[0:10][0:5:2][9:10:-1][x:y:z] = 5;
54
55 return 0;
56 }