| 1 |
// { dg-do compile } |
| 2 |
// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'. |
| 3 |
// { dg-options "-fopenmp" } |
| 4 |
// { dg-require-effective-target fopenmp } |
| 5 |
|
| 6 |
class GException { |
| 7 |
public: |
| 8 |
class vector_mismatch { |
| 9 |
public: |
| 10 |
vector_mismatch(int size1, int size2); |
| 11 |
}; |
| 12 |
}; |
| 13 |
class GVector{ |
| 14 |
public: |
| 15 |
GVector& operator+=(const GVector& v); |
| 16 |
int m_num; |
| 17 |
double* m_data; |
| 18 |
}; |
| 19 |
inline GVector& GVector::operator+= (const GVector& v) |
| 20 |
{ |
| 21 |
if (m_num != v.m_num) |
| 22 |
throw GException::vector_mismatch(m_num, v.m_num); |
| 23 |
for (int i = 0; i < m_num; ++i) m_data[i] += v.m_data[i]; |
| 24 |
}; // { dg-warning "control reaches end of non-void function" } |
| 25 |
void eval(GVector* m_gradient, GVector* vect_cpy_grad, int n) |
| 26 |
{ |
| 27 |
#pragma omp sections |
| 28 |
{ |
| 29 |
for (int i = 0; i < n; ++i) |
| 30 |
*m_gradient += vect_cpy_grad[i]; |
| 31 |
} |
| 32 |
} |