(root)/
gcc-13.2.0/
gcc/
testsuite/
c-c++-common/
gomp/
depend-iterator-1.c
       1  /* { dg-additional-options "-Wno-volatile" { target c++ } } */
       2  
       3  int arr[64], arr2[64];
       4  struct S { int a[4]; } k;
       5  short arr4[4];
       6  volatile int v;
       7  #define TEST_EQ(x,y) ({ int o[x == y ? 1 : -1]; 0; })
       8  
       9  void
      10  foo (unsigned char i, signed char j)
      11  {
      12    #pragma omp task depend (iterator (j=6:2:-2) , out : \
      13  	arr[TEST_EQ (sizeof (j), sizeof (int)), \
      14  	    TEST_EQ (sizeof (i), sizeof (unsigned char)), \
      15  	    TEST_EQ (sizeof (k), sizeof (struct S)), j], \
      16  	arr2[TEST_EQ (((__typeof (j)) -1) < 0, 1), \
      17  	     TEST_EQ (((__typeof (i)) -1) < 0, 0), \
      18  	     TEST_EQ (((__typeof (k.a[0])) -1) < 0, 1), j]) \
      19  	depend(out: arr[0]) \
      20  	depend (iterator (long long i=__LONG_LONG_MAX__ - 4:__LONG_LONG_MAX__ - 2:2, \
      21  			  unsigned short j=~0U-16:~0U-8:3, \
      22  			  short *k=&arr4[1]:&arr4[2]:1) , in : \
      23  	arr[TEST_EQ (sizeof (i), sizeof (long long)), \
      24  	    TEST_EQ (sizeof (j), sizeof (unsigned short)), \
      25  	    TEST_EQ (sizeof (k), sizeof (short *)), \
      26  	    TEST_EQ (sizeof (*k), sizeof (short)), i - __LONG_LONG_MAX__ + 4], \
      27  	arr2[TEST_EQ (((__typeof (i)) -1) < 0, 1), \
      28  	     TEST_EQ (((__typeof (j)) -1) < 0, 0), \
      29  	     TEST_EQ (((__typeof (*k)) -1) < 0, 1), j - (~0U-16)], \
      30  	arr2[k - &arr4[0]]) \
      31  	depend(in : k)
      32      v++;
      33  }
      34  
      35  void
      36  bar (unsigned char i, signed char j)
      37  {
      38    int m = j;
      39    int n = j + 2;
      40    #pragma omp task depend (iterator (j=6:2:m) , out : \
      41  	arr[TEST_EQ (sizeof (j), sizeof (int)), \
      42  	    TEST_EQ (sizeof (i), sizeof (unsigned char)), \
      43  	    TEST_EQ (sizeof (k), sizeof (struct S)), j], \
      44  	arr2[TEST_EQ (((__typeof (j)) -1) < 0, 1), \
      45  	     TEST_EQ (((__typeof (i)) -1) < 0, 0), \
      46  	     TEST_EQ (((__typeof (k.a[0])) -1) < 0, 1), j]) \
      47  	depend(out: arr[0]) \
      48  	depend (iterator (long long i=__LONG_LONG_MAX__ - 4 - n:__LONG_LONG_MAX__ - 2:2, \
      49  			  unsigned short j=~0U-16:~0U-8-n:3, \
      50  			  short *k=&arr4[1]:&arr4[n + 2]:1) , in : \
      51  	arr[TEST_EQ (sizeof (i), sizeof (long long)), \
      52  	    TEST_EQ (sizeof (j), sizeof (unsigned short)), \
      53  	    TEST_EQ (sizeof (k), sizeof (short *)), \
      54  	    TEST_EQ (sizeof (*k), sizeof (short)), i - __LONG_LONG_MAX__ + 4], \
      55  	arr2[TEST_EQ (((__typeof (i)) -1) < 0, 1), \
      56  	     TEST_EQ (((__typeof (j)) -1) < 0, 0), \
      57  	     TEST_EQ (((__typeof (*k)) -1) < 0, 1), j - (~0U-16)], \
      58  	arr2[k - &arr4[0]:10]) \
      59  	depend(in : k)
      60      v++;
      61  }
      62  
      63  void
      64  baz (void)
      65  {
      66    #pragma omp parallel
      67    #pragma omp master
      68    {
      69      #pragma omp task depend(iterator(unsigned long int k = 0 : 2) , inout : \
      70  	arr[TEST_EQ (sizeof (k), sizeof (unsigned long)), \
      71  	    TEST_EQ (((__typeof (k)) -1) < 0, 0), k]) \
      72  	depend(iterator(signed char s = -3 : -12 : -1) , out : \
      73  	arr[TEST_EQ (sizeof (s), sizeof (signed char)), \
      74  	    TEST_EQ (((__typeof (s)) -1) < 0, 1), s + 12])
      75        v++;
      76    }
      77  }