https://gcc.gnu.org/g:6312165650091a4df34668d8e2aaa0bbc4008a66

commit r15-7443-g6312165650091a4df34668d8e2aaa0bbc4008a66
Author: Thomas Schwinge <tschwi...@baylibre.com>
Date:   Tue Jan 28 14:57:21 2025 +0100

    GCN, nvptx: 'sorry, unimplemented: exception handling not supported'
    
    For GCN, this avoids ICEs further down the compilation pipeline.  For nvptx,
    there's effectively no change: in presence of exception handling constructs,
    instead of 'sorry, unimplemented: target cannot support nonlocal goto', we
    now emit 'sorry, unimplemented: exception handling not supported'.
    
    Additionally, turn test cases into UNSUPPORTED if running into
    'sorry, unimplemented: exception handling not supported'.
    
            gcc/
            * config/gcn/gcn.md (exception_receiver): 'define_expand'.
            * config/nvptx/nvptx.md (exception_receiver): Likewise.
            gcc/testsuite/
            * lib/gcc-dg.exp (gcc-dg-prune): Turn
            'sorry, unimplemented: exception handling not supported' into
            UNSUPPORTED.
            * gcc.dg/pr104464.c: Remove GCN XFAIL.
            libstdc++-v3/
            * testsuite/lib/prune.exp (libstdc++-dg-prune): Turn
            'sorry, unimplemented: exception handling not supported' into
            UNSUPPORTED.

Diff:
---
 gcc/config/gcn/gcn.md                | 7 +++++++
 gcc/config/nvptx/nvptx.md            | 7 +++++++
 gcc/testsuite/gcc.dg/pr104464.c      | 2 --
 gcc/testsuite/lib/gcc-dg.exp         | 7 +++++++
 libstdc++-v3/testsuite/lib/prune.exp | 7 +++++++
 5 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/gcc/config/gcn/gcn.md b/gcc/config/gcn/gcn.md
index 9dddfca742b4..695656f692d6 100644
--- a/gcc/config/gcn/gcn.md
+++ b/gcc/config/gcn/gcn.md
@@ -1014,6 +1014,13 @@
   [(set_attr "type" "sopp")
    (set_attr "length" "4")])
 
+(define_expand "exception_receiver"
+  [(const_int 0)]
+  ""
+{
+  sorry ("exception handling not supported");
+})
+
 ;; }}}
 ;; {{{ Conditionals
 
diff --git a/gcc/config/nvptx/nvptx.md b/gcc/config/nvptx/nvptx.md
index a22a088fb3ac..d3d538070c0f 100644
--- a/gcc/config/nvptx/nvptx.md
+++ b/gcc/config/nvptx/nvptx.md
@@ -1640,6 +1640,13 @@
   DONE;
 })
 
+(define_expand "exception_receiver"
+  [(const_int 0)]
+  ""
+{
+  sorry ("exception handling not supported");
+})
+
 (define_expand "nonlocal_goto"
   [(match_operand 0 "" "")
    (match_operand 1 "" "")
diff --git a/gcc/testsuite/gcc.dg/pr104464.c b/gcc/testsuite/gcc.dg/pr104464.c
index d36a28678cb6..ed6a22c39d5e 100644
--- a/gcc/testsuite/gcc.dg/pr104464.c
+++ b/gcc/testsuite/gcc.dg/pr104464.c
@@ -9,5 +9,3 @@ foo(void)
 {
   f += (F)(f != (F){}[0]);
 }
-
-/* { dg-xfail-if "-fnon-call-exceptions unsupported" { amdgcn-*-* } } */
diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp
index 07a996a44669..70be7a8d5fd1 100644
--- a/gcc/testsuite/lib/gcc-dg.exp
+++ b/gcc/testsuite/lib/gcc-dg.exp
@@ -434,6 +434,13 @@ proc gcc-dg-prune { system text } {
        return "::unsupported::large return values"
     }
 
+    # If exception handling is not supported, expectant tests are UNSUPPORTED.
+    if { ![check_effective_target_exceptions] } {
+       if [regexp "(^|\n)\[^\n\]*: sorry, unimplemented: exception handling 
not supported" $text] {
+           return "::unsupported::exception handling not supported"
+       }
+    }
+
     # If exception handling is disabled, expectant tests are UNSUPPORTED.
     if { ![check_effective_target_exceptions_enabled] } {
        if [regexp "(^|\n)\[^\n\]*: error: exception handling disabled" $text] {
diff --git a/libstdc++-v3/testsuite/lib/prune.exp 
b/libstdc++-v3/testsuite/lib/prune.exp
index 593b74985fbe..566572baa6da 100644
--- a/libstdc++-v3/testsuite/lib/prune.exp
+++ b/libstdc++-v3/testsuite/lib/prune.exp
@@ -89,6 +89,13 @@ proc libstdc++-dg-prune { system text } {
     # the single uncapitalized "in function" line.
     regsub -all "(^|\n)\[^\n\]*: in function\[^\n\]*" $text "" text
 
+    # If exception handling is not supported, expectant tests are UNSUPPORTED.
+    if { ![check_effective_target_exceptions] } {
+       if [regexp "(^|\n)\[^\n\]*: sorry, unimplemented: exception handling 
not supported" $text] {
+           return "::unsupported::exception handling not supported"
+       }
+    }
+
     # If exception handling is disabled, expectant tests are UNSUPPORTED.
     if { ![check_effective_target_exceptions_enabled] } {
        if [regexp "(^|\n)\[^\n\]*: error: exception handling disabled" $text] {

Reply via email to