// { dg-do run } typedef __PTRDIFF_TYPE__ ptrdiff_t; template class I { public: typedef ptrdiff_t difference_type; I (); ~I (); I (T *); I (const I &); T &operator * (); T *operator -> (); T &operator [] (const difference_type &) const; I &operator = (const I &); I &operator ++ (); I operator ++ (int); I &operator -- (); I operator -- (int); I &operator += (const difference_type &); I &operator -= (const difference_type &); I operator + (const difference_type &) const; I operator - (const difference_type &) const; template friend bool operator == (I &, I &); template friend bool operator == (const I &, const I &); template friend bool operator < (I &, I &); template friend bool operator < (const I &, const I &); template friend bool operator <= (I &, I &); template friend bool operator <= (const I &, const I &); template friend bool operator > (I &, I &); template friend bool operator > (const I &, const I &); template friend bool operator >= (I &, I &); template friend bool operator >= (const I &, const I &); template friend typename I::difference_type operator - (I &, I &); template friend typename I::difference_type operator - (const I &, const I &); template friend I operator + (typename I::difference_type , const I &); private: T *p; }; template I::I () : p (0) {} template I::~I () {} template I::I (T *x) : p (x) {} template I::I (const I &x) : p (x.p) {} template T &I::operator * () { return *p; } template T *I::operator -> () { return p; } template T &I::operator [] (const difference_type &x) const { return p[x]; } template I &I::operator = (const I &x) { p = x.p; return *this; } template I &I::operator ++ () { ++p; return *this; } template I I::operator ++ (int) { return I (p++); } template I &I::operator -- () { --p; return *this; } template I I::operator -- (int) { return I (p--); } template I &I::operator += (const difference_type &x) { p += x; return *this; } template I &I::operator -= (const difference_type &x) { p -= x; return *this; } template I I::operator + (const difference_type &x) const { return I (p + x); } template I I::operator - (const difference_type &x) const { return I (p - x); } template bool operator == (I &x, I &y) { return x.p == y.p; } template bool operator == (const I &x, const I &y) { return x.p == y.p; } template bool operator != (I &x, I &y) { return !(x == y); } template bool operator != (const I &x, const I &y) { return !(x == y); } template bool operator < (I &x, I &y) { return x.p < y.p; } template bool operator < (const I &x, const I &y) { return x.p < y.p; } template bool operator <= (I &x, I &y) { return x.p <= y.p; } template bool operator <= (const I &x, const I &y) { return x.p <= y.p; } template bool operator > (I &x, I &y) { return x.p > y.p; } template bool operator > (const I &x, const I &y) { return x.p > y.p; } template bool operator >= (I &x, I &y) { return x.p >= y.p; } template bool operator >= (const I &x, const I &y) { return x.p >= y.p; } template typename I::difference_type operator - (I &x, I &y) { return x.p - y.p; } template typename I::difference_type operator - (const I &x, const I &y) { return x.p - y.p; } template I operator + (typename I::difference_type x, const I &y) { return I (x + y.p); } struct R { R () {}; ~R () {}; I r; }; struct T { T () {}; virtual ~T () {}; I t; }; struct A : public R, virtual public T { A () {} I a; void m1 (const I &, const I &); }; template struct U { U () {}; virtual ~U () {}; Q t; }; template struct B : public R, virtual public U { B () {} Q a; void m2 (const Q &, const Q &, const I &, const I &); }; int d[64]; void A::m1 (const I &x, const I &y) { int w = 0; #pragma omp parallel for private (a) reduction(|:w) for (a = x; A::a < y - 33; a += 2) w |= (1 << *A::a); if (w != 0x55555555) __builtin_abort (); #pragma omp parallel for lastprivate (t) for (T::t = x; t < y - 32; t += 3) d[*T::t + 2] |= 1; if (*T::t != 33) __builtin_abort (); for (int i = 0; i < 64; i++) if (d[i] != ((i >= 2 && i < 32 + 2 && (i - 2) % 3 == 0) ? 1 : 0)) __builtin_abort (); w = 0; #pragma omp parallel for reduction(|:w) for (a = x; A::a < y - 33; a += 2) w |= (1 << *A::a); if (w != 0x55555555) __builtin_abort (); #pragma omp taskloop for (R::r = x; r < y - 32; R::r += 2) d[*r + 8] |= 2; for (int i = 0; i < 64; i++) if (d[i] != (((i >= 2 && i < 32 + 2 && (i - 2) % 3 == 0) ? 1 : 0) | ((i >= 8 && i < 32 + 8 && (i & 1) == 0) ? 2 : 0))) __builtin_abort (); #pragma omp taskloop collapse(2) for (T::t = x; t < y - 57; t += 2) for (a = x; A::a < y - 56; a++) d[((*t << 2) | *a) + 3] |= 4; for (int i = 0; i < 64; i++) if (d[i] != (((i >= 2 && i < 32 + 2 && (i - 2) % 3 == 0) ? 1 : 0) | ((i >= 8 && i < 32 + 8 && (i & 1) == 0) ? 2 : 0) | ((i >= 3 && i < 32 + 3) ? 4 : 0))) __builtin_abort (); } template void B::m2 (const Q &u, const Q &v, const I &x, const I &y) { int w = 0; #pragma omp parallel for private (a) reduction(|:w) for (a = u; B::a < v - 33; a += 2) w |= (1 << *B::a); if (w != 0x55555555) __builtin_abort (); #pragma omp parallel for lastprivate (U::t) for (U::t = u; U::t < v - 32; U::t += 3) d[*U::t + 2] |= 1; if (*U::t != 33) __builtin_abort (); for (int i = 0; i < 64; i++) if (d[i] != ((i >= 2 && i < 32 + 2 && (i - 2) % 3 == 0) ? 1 : 0)) __builtin_abort (); w = 0; #pragma omp parallel for reduction(|:w) for (a = u; B::a < v - 33; a += 2) w |= (1 << *B::a); if (w != 0x55555555) __builtin_abort (); #pragma omp taskloop for (R::r = x; r < y - 32; R::r += 2) d[*r + 8] |= 2; for (int i = 0; i < 64; i++) if (d[i] != (((i >= 2 && i < 32 + 2 && (i - 2) % 3 == 0) ? 1 : 0) | ((i >= 8 && i < 32 + 8 && (i & 1) == 0) ? 2 : 0))) __builtin_abort (); #pragma omp taskloop collapse(2) for (U::t = u; U::t < v - 57; U::t += 2) for (a = u; B::a < v - 56; a++) d[((*U::t << 2) | *a) + 3] |= 4; for (int i = 0; i < 64; i++) if (d[i] != (((i >= 2 && i < 32 + 2 && (i - 2) % 3 == 0) ? 1 : 0) | ((i >= 8 && i < 32 + 8 && (i & 1) == 0) ? 2 : 0) | ((i >= 3 && i < 32 + 3) ? 4 : 0))) __builtin_abort (); } int main () { A a; int b[128]; for (int i = 0; i < 128; i++) b[i] = i - 32; a.m1 (&b[32], &b[96]); for (int i = 0; i < 64; i++) d[i] = 0; B > c; c.m2 (&b[32], &b[96], &b[32], &b[96]); for (int i = 0; i < 64; i++) d[i] = 0; B d; d.m2 (&b[32], &b[96], &b[32], &b[96]); }