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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
  
     | 
    
      /* { dg-additional-options "-Wno-volatile" { target c++ } } */
int arr[64], arr2[64];
struct S { int a[4]; } k;
short arr4[4];
volatile int v;
#define TEST_EQ(x,y) ({ int o[x == y ? 1 : -1]; 0; })
void
foo (unsigned char i, signed char j)
{
  #pragma omp task affinity (iterator (j=6:2:-2) : \
	arr[TEST_EQ (sizeof (j), sizeof (int)), \
	    TEST_EQ (sizeof (i), sizeof (unsigned char)), \
	    TEST_EQ (sizeof (k), sizeof (struct S)), j], \
	arr2[TEST_EQ (((__typeof (j)) -1) < 0, 1), \
	     TEST_EQ (((__typeof (i)) -1) < 0, 0), \
	     TEST_EQ (((__typeof (k.a[0])) -1) < 0, 1), j]) \
	affinity(arr[0]) \
	affinity (iterator (long long i=__LONG_LONG_MAX__ - 4:__LONG_LONG_MAX__ - 2:2, \
			  unsigned short j=~0U-16:~0U-8:3, \
			  short *k=&arr4[1]:&arr4[2]:1) : \
	arr[TEST_EQ (sizeof (i), sizeof (long long)), \
	    TEST_EQ (sizeof (j), sizeof (unsigned short)), \
	    TEST_EQ (sizeof (k), sizeof (short *)), \
	    TEST_EQ (sizeof (*k), sizeof (short)), i - __LONG_LONG_MAX__ + 4], \
	arr2[TEST_EQ (((__typeof (i)) -1) < 0, 1), \
	     TEST_EQ (((__typeof (j)) -1) < 0, 0), \
	     TEST_EQ (((__typeof (*k)) -1) < 0, 1), j - (~0U-16)], \
	arr2[k - &arr4[0]]) \
	affinity( k)
    v++;
}
void
bar (unsigned char i, signed char j)
{
  int m = j;
  int n = j + 2;
  #pragma omp task affinity (iterator (j=6:2:m) : \
	arr[TEST_EQ (sizeof (j), sizeof (int)), \
	    TEST_EQ (sizeof (i), sizeof (unsigned char)), \
	    TEST_EQ (sizeof (k), sizeof (struct S)), j], \
	arr2[TEST_EQ (((__typeof (j)) -1) < 0, 1), \
	     TEST_EQ (((__typeof (i)) -1) < 0, 0), \
	     TEST_EQ (((__typeof (k.a[0])) -1) < 0, 1), j]) \
	affinity( arr[0]) \
	affinity (iterator (long long i=__LONG_LONG_MAX__ - 4 - n:__LONG_LONG_MAX__ - 2:2, \
			  unsigned short j=~0U-16:~0U-8-n:3, \
			  short *k=&arr4[1]:&arr4[n + 2]:1) : \
	arr[TEST_EQ (sizeof (i), sizeof (long long)), \
	    TEST_EQ (sizeof (j), sizeof (unsigned short)), \
	    TEST_EQ (sizeof (k), sizeof (short *)), \
	    TEST_EQ (sizeof (*k), sizeof (short)), i - __LONG_LONG_MAX__ + 4], \
	arr2[TEST_EQ (((__typeof (i)) -1) < 0, 1), \
	     TEST_EQ (((__typeof (j)) -1) < 0, 0), \
	     TEST_EQ (((__typeof (*k)) -1) < 0, 1), j - (~0U-16)], \
	arr2[k - &arr4[0]:10]) \
	affinity( k)
    v++;
}
void
baz (void)
{
  #pragma omp parallel
  #pragma omp master
  {
    #pragma omp task affinity(iterator(unsigned long int k = 0 : 2) : \
	arr[TEST_EQ (sizeof (k), sizeof (unsigned long)), \
	    TEST_EQ (((__typeof (k)) -1) < 0, 0), k]) \
	affinity(iterator(signed char s = -3 : -12 : -1) : \
	arr[TEST_EQ (sizeof (s), sizeof (signed char)), \
	    TEST_EQ (((__typeof (s)) -1) < 0, 1), s + 12])
      v++;
  }
}
 
     |