| 1 |
/* 'std::bad_cast' exception in OpenMP 'target' region. */ |
| 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 |
|
| 8 |
#include "../libgomp.oacc-c++/exceptions-bad_cast-1.C" |
| 9 |
|
| 10 |
/* { dg-output {CheCKpOInT[\r\n]+} } |
| 11 |
|
| 12 |
{ dg-final { scan-tree-dump-times {gimple_call <__cxa_bad_cast, } 1 optimized } } |
| 13 |
{ dg-final { scan-offload-tree-dump-times {gimple_call <__cxa_bad_cast, } 1 optimized } } |
| 14 |
For host execution, we print something like: |
| 15 |
terminate called after throwing an instance of 'std::bad_cast' |
| 16 |
what(): std::bad_cast |
| 17 |
Aborted (core dumped) |
| 18 |
{ dg-output {.*std::bad_cast} { target { ! offload_device } } } |
| 19 |
For GCN, nvptx offload execution, we don't print anything, but just 'abort'. |
| 20 |
|
| 21 |
TODO For GCN, nvptx offload execution, this currently doesn't 'abort' due to |
| 22 |
the 'std::bad_cast' exception, but rather due to SIGSEGV in 'dynamic_cast'; |
| 23 |
PR119692. |
| 24 |
|
| 25 |
{ dg-shouldfail {'std::bad_cast' exception} } */ |
| 26 |
/* There are configurations where we 'WARNING: program timed out.' while in |
| 27 |
'dynamic_cast', see <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119692#c6>. |
| 28 |
{ dg-timeout 10 { target offload_device } } ... to make sure that happens quickly. */ |