| 1 |
/* 'throw' in OpenACC compute region, dead code. */ |
| 2 |
|
| 3 |
/* { dg-require-effective-target exceptions } |
| 4 |
{ dg-additional-options -fexceptions } */ |
| 5 |
/* Wrong code for offloading execution. |
| 6 |
{ dg-skip-if PR119692 { ! openacc_host_selected } } |
| 7 |
{ dg-additional-options -fdump-tree-gimple } */ |
| 8 |
/* { dg-additional-options -fdump-tree-optimized-raw } */ |
| 9 |
|
| 10 |
/* See also '../libgomp.c++/target-exceptions-throw-3.C'. */ |
| 11 |
|
| 12 |
/* See also '../../../gcc/testsuite/g++.target/gcn/exceptions-throw-3.C', |
| 13 |
'../../../gcc/testsuite/g++.target/nvptx/exceptions-throw-3.C'. */ |
| 14 |
|
| 15 |
/* For PR119692 workarounds. */ |
| 16 |
#ifndef DEFAULT |
| 17 |
# define DEFAULT |
| 18 |
#endif |
| 19 |
|
| 20 |
class MyException |
| 21 |
{ |
| 22 |
}; |
| 23 |
|
| 24 |
int main() |
| 25 |
{ |
| 26 |
#pragma omp target DEFAULT |
| 27 |
#pragma acc serial DEFAULT |
| 28 |
/* { dg-bogus {using 'vector_length \(32\)', ignoring 1} {} { target openacc_nvidia_accel_selected xfail *-*-* } .-1 } */ |
| 29 |
{ |
| 30 |
bool a = false; |
| 31 |
asm volatile ("" : : "r" (&a) : "memory"); |
| 32 |
if (a) |
| 33 |
{ |
| 34 |
MyException e1; |
| 35 |
throw e1; |
| 36 |
} |
| 37 |
} |
| 38 |
} |
| 39 |
|
| 40 |
/* { dg-final { scan-tree-dump-not {(?n)#pragma omp target oacc_serial map\(tofrom:_ZTI11MyException \[len: [0-9]+\]\)$} gimple { xfail *-*-* } } } */ |
| 41 |
|
| 42 |
/* { dg-final { scan-tree-dump-times {gimple_call <__cxa_allocate_exception, } 1 optimized } } |
| 43 |
{ dg-final { scan-tree-dump-times {gimple_call <__cxa_throw, } 1 optimized } } */ |