aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorThomas Schwinge <tschwinge@baylibre.com>2025-03-27 14:46:20 +0100
committerThomas Schwinge <tschwinge@baylibre.com>2025-04-14 23:54:53 +0200
commit0e68f49db986d8d6c1eaaa96dd14f7b2a927a0d0 (patch)
tree867dc3acad781505f4fd0f1b956a14fbd1d04871 /gcc
parentaa3e72f943032e5f074b2bd2fd06d130dda8760b (diff)
downloadgcc-0e68f49db986d8d6c1eaaa96dd14f7b2a927a0d0.zip
gcc-0e68f49db986d8d6c1eaaa96dd14f7b2a927a0d0.tar.gz
gcc-0e68f49db986d8d6c1eaaa96dd14f7b2a927a0d0.tar.bz2
Add 'std::bad_cast' exception test cases for GCN, nvptx target and OpenACC, OpenMP 'target' offloading
gcc/testsuite/ * g++.target/gcn/exceptions-bad_cast-1.C: New. * g++.target/nvptx/exceptions-bad_cast-1.C: Likewise. libgomp/ * testsuite/libgomp.c++/target-exceptions-bad_cast-1.C: New. * testsuite/libgomp.oacc-c++/exceptions-bad_cast-1.C: Likewise.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/g++.target/gcn/exceptions-bad_cast-1.C15
-rw-r--r--gcc/testsuite/g++.target/nvptx/exceptions-bad_cast-1.C15
2 files changed, 30 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.target/gcn/exceptions-bad_cast-1.C b/gcc/testsuite/g++.target/gcn/exceptions-bad_cast-1.C
new file mode 100644
index 0000000..f3e3099
--- /dev/null
+++ b/gcc/testsuite/g++.target/gcn/exceptions-bad_cast-1.C
@@ -0,0 +1,15 @@
+/* 'std::bad_cast' exception. */
+
+/* { dg-do run } */
+/* Via the magic string "-std=*++" indicate that testing one (the default) C++ standard is sufficient. */
+/* { dg-additional-options -fexceptions } */
+/* { dg-additional-options -fdump-tree-optimized-raw } */
+
+#include "../../../../libgomp/testsuite/libgomp.oacc-c++/exceptions-bad_cast-1.C"
+
+/* { dg-output {CheCKpOInT[\r\n]+} }
+
+ { dg-final { scan-tree-dump-times {gimple_call <__cxa_bad_cast, } 1 optimized } }
+ We don't print anything, but just 'abort'.
+
+ { dg-shouldfail {'std::bad_cast' exception} } */
diff --git a/gcc/testsuite/g++.target/nvptx/exceptions-bad_cast-1.C b/gcc/testsuite/g++.target/nvptx/exceptions-bad_cast-1.C
new file mode 100644
index 0000000..f3e3099
--- /dev/null
+++ b/gcc/testsuite/g++.target/nvptx/exceptions-bad_cast-1.C
@@ -0,0 +1,15 @@
+/* 'std::bad_cast' exception. */
+
+/* { dg-do run } */
+/* Via the magic string "-std=*++" indicate that testing one (the default) C++ standard is sufficient. */
+/* { dg-additional-options -fexceptions } */
+/* { dg-additional-options -fdump-tree-optimized-raw } */
+
+#include "../../../../libgomp/testsuite/libgomp.oacc-c++/exceptions-bad_cast-1.C"
+
+/* { dg-output {CheCKpOInT[\r\n]+} }
+
+ { dg-final { scan-tree-dump-times {gimple_call <__cxa_bad_cast, } 1 optimized } }
+ We don't print anything, but just 'abort'.
+
+ { dg-shouldfail {'std::bad_cast' exception} } */