Debian Codegraph @

libgomp/testsuite/libgomp.oacc-c++/exceptions-throw-2.C

raw
1 /* 'throw' in OpenACC compute region, caught. */
2
3 /* { dg-require-effective-target exceptions }
4 { dg-additional-options -fexceptions } */
5 /* { dg-additional-options -fdump-tree-optimized-raw }
6 { dg-additional-options -foffload-options=-fdump-tree-optimized-raw } */
7 /* { dg-bogus {undefined symbol: typeinfo name for MyException} PR119806 { target { openacc_radeon_accel_selected && { ! __OPTIMIZE__ } } xfail *-*-* } 0 }
8 { dg-excess-errors {'mkoffload' failure etc.} { xfail { openacc_radeon_accel_selected && { ! __OPTIMIZE__ } } } } */
9 /* { dg-bogus {Initial value type mismatch} PR119806 { target { openacc_nvidia_accel_selected && { ! __OPTIMIZE__ } } xfail *-*-* } 0 }
10 { dg-excess-errors {'mkoffload' failure etc.} { xfail { openacc_nvidia_accel_selected && { ! __OPTIMIZE__ } } } } */
11
12 /* See also '../libgomp.c++/target-exceptions-throw-2.C'. */
13
14 /* See also '../../../gcc/testsuite/g++.target/gcn/exceptions-throw-2.C',
15 '../../../gcc/testsuite/g++.target/nvptx/exceptions-throw-2.C'. */
16
17 #include <iostream>
18
19 class MyException
20 {
21 };
22
23 int main()
24 {
25 std::cerr << "CheCKpOInT\n";
26 #pragma omp target
27 #pragma acc serial
28 /* { dg-bogus {using 'vector_length \(32\)', ignoring 1} {} { target openacc_nvidia_accel_selected xfail *-*-* } .-1 } */
29 {
30 try
31 {
32 MyException e1;
33 throw e1;
34 }
35 catch (const MyException &e)
36 {
37 __builtin_printf("caught '%s'\n", "MyException");
38 }
39 }
40 }
41
42 /* { dg-output {CheCKpOInT[\r\n]+} }
43
44 { dg-final { scan-tree-dump-times {gimple_call <__cxa_allocate_exception, } 1 optimized } }
45 { dg-final { scan-tree-dump-times {gimple_call <__cxa_throw, } 1 optimized } }
46 { dg-final { scan-offload-tree-dump-times {gimple_call <__cxa_allocate_exception, } 1 optimized } }
47 { dg-final { scan-offload-tree-dump-times {gimple_call <__cxa_throw, } 1 optimized } }
48 { dg-output {.*caught 'MyException'[\r\n]+} { target openacc_host_selected } }
49 For GCN, nvptx offload execution, we don't print anything, but just 'abort'.
50
51 For GCN, nvptx offload execution, there is no 'catch'ing; any exception is fatal.
52 { dg-shouldfail {'MyException' exception} { ! openacc_host_selected } } */