aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/if_test_errors.c
blob: 579d396948e7468f443bfeccff0b308c9da74ea3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* { dg-do compile } */
/* { dg-options "-fcilkplus" } */

#include <stdlib.h>
int main (void)
{
  int x = 3, y, z, array[10], array2[10], TwodArray[10][10], jj,kk,ll ;
  int array2_check[10], array2d_check[10][10], array2d[10][10];
  int FourDArray[10][10][10][10], array4[10][10][10][10];
  int array4_check[10][10][10][10];
  int ii = 0;

  x = 5;
  y = 10;
  z = 2;

  if (!array[:]) /* This is OK! */
    array2[:] = 5;
  else
    array2[:] = 10;
  if (!(array[0:10:1] + array[0:10:1])) /* { dg-error "condition and the then-block" "" { target c } } */
    array2d[:][:] = 5; /* { dg-error "rank mismatch with controlling expression of parent" "" { target c++ } } */
  else
    array2[:] = 10;

  if (!(array[0:10:1] + array[0:10:1])) /* { dg-error "condition and the else-block" "" { target c } } */
    array2[:] = 5;
  else
    array2d[:][:] = 10; /* { dg-error "rank mismatch with controlling expression of parent" "" { target c++ } } */


  if (TwodArray[:][:] != 10) /* { dg-error "condition and the then-block" "" { target c } } */
    array2[:] = 10;  /* { dg-error "rank mismatch with controlling expression of parent" "" { target c++ } } */
  else
    array2[:] = 5;

  if (FourDArray[43][:][:][:] != 10) /* This is OK!  */ 
    array4[45][:][:][:] = 10; 
  else
    array4[32][:][:][:] = 5;

  /* atoi(argv[1]) == 10, so it will convert all 10's to 5's */
  if (FourDArray[42][0:10:1][9:10:-1][0:5:2] != 10) /* { dg-error "condition and the then-block" "" { target c } } */
    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++ } } */
  else
    array4[0:10:1][0:5:2][9:10:-1][0:5:2] = 5;

  /* atoi(argv[1]) == 10, so it will convert all 10's to 5's */
  if (FourDArray[0:10:1][0:5:2][9:10:-1][x:y:z] +
      FourDArray[0:10:1][0:5:2][9:-10:1][x:y:z]  != 20) 
    array4[0:10:1][0:5:2][9:10:-1][x:y:z] = 10; 
  else
    array4[0:10][0:5:2][9:10:-1][x:y:z] = 5;

  return 0;
}