comparison gcc/testsuite/g++.dg/torture/pr56694.C @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children 84e7813d76e9
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 // { dg-do compile }
2 // { dg-options "-fopenmp" }
3 // { dg-require-effective-target fopenmp }
4
5 class GException {
6 public:
7 class vector_mismatch {
8 public:
9 vector_mismatch(int size1, int size2);
10 };
11 };
12 class GVector{
13 public:
14 GVector& operator+=(const GVector& v);
15 int m_num;
16 double* m_data;
17 };
18 inline GVector& GVector::operator+= (const GVector& v)
19 {
20 if (m_num != v.m_num)
21 throw GException::vector_mismatch(m_num, v.m_num);
22 for (int i = 0; i < m_num; ++i) m_data[i] += v.m_data[i];
23 };
24 void eval(GVector* m_gradient, GVector* vect_cpy_grad, int n)
25 {
26 #pragma omp sections
27 {
28 for (int i = 0; i < n; ++i)
29 *m_gradient += vect_cpy_grad[i];
30 }
31 }