Fix xfail for 32-bit hppa*-*-* in gcc.dg/pr84877.c
[official-gcc.git] / libgomp / testsuite / libgomp.c++ / target-virtual-1.C
bloba6ac30e7cf0a63c1d6d50c935da3835a0739bf1d
1 /* { dg-do run } */
2 /* Check that classes with virtual member functions works,
3    when using it as declared type. */
4 struct base {
5     float data [100];
7     base() = default;
8     virtual ~base() = default;
9 };
11 struct derived : public base {
12     int scalar, array[5];
14     derived() = default;
15     void do_work ()
16     {
17       int error = 0;
18       #pragma omp target map (tofrom: this[:1], error)
19       {
20         if (scalar != 42 || this->array[0] != 123 || array[4] != 555)
21           error = 1;
22         if (data[0] != 333 || data[99] != -3)
23           error = 1;
24         this->scalar = 99;
25         array[0] = 5;
26         array[4] = -4;
27         this->data[0] = 11;
28         this->data[99] = 99;
29       }
30       if (error)
31         __builtin_abort ();
32       if (data[0] != 11 || data[99] != 99)
33         __builtin_abort ();
34       if (scalar != 99 || array[0] != 5 || array[4] != -4)
35         __builtin_abort ();
36     }   
39 int
40 main ()
42   struct derived x;
43   x.data[0] = 333;
44   x.data[99] = -3;
45   x.scalar = 42;
46   x.array[0] = 123;
47   x.array[4] = 555;
48   x.do_work ();
49   return 0;