https://gcc.gnu.org/g:40ed192ee1d03bbbd20ec9aee8e75f475904fe40

commit 40ed192ee1d03bbbd20ec9aee8e75f475904fe40
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.
    
    (cherry picked from commit 6312165650091a4df34668d8e2aaa0bbc4008a66)

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

diff --git a/gcc/ChangeLog.omp b/gcc/ChangeLog.omp
index 869afd96f6e0..33e6e677d7b9 100644
--- a/gcc/ChangeLog.omp
+++ b/gcc/ChangeLog.omp
@@ -3,6 +3,12 @@
        Backported from trunk:
        2025-02-08  Thomas Schwinge  <tschwi...@baylibre.com>
 
+       * config/gcn/gcn.md (exception_receiver): 'define_expand'.
+       * config/nvptx/nvptx.md (exception_receiver): Likewise.
+
+       Backported from trunk:
+       2025-02-08  Thomas Schwinge  <tschwi...@baylibre.com>
+
        * doc/sourcebuild.texi (Effective-Target Keywords): Clarify that
        effective-target 'exceptions' and 'exceptions_enabled' are
        orthogonal.
diff --git a/gcc/config/gcn/gcn.md b/gcc/config/gcn/gcn.md
index 574c2f87e8c9..53f4f20a6422 100644
--- a/gcc/config/gcn/gcn.md
+++ b/gcc/config/gcn/gcn.md
@@ -1017,6 +1017,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 a4cc9d280c5c..a9c7a6d6924e 100644
--- a/gcc/config/nvptx/nvptx.md
+++ b/gcc/config/nvptx/nvptx.md
@@ -1661,6 +1661,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/ChangeLog.omp b/gcc/testsuite/ChangeLog.omp
index a3854b867c3e..3a4394172422 100644
--- a/gcc/testsuite/ChangeLog.omp
+++ b/gcc/testsuite/ChangeLog.omp
@@ -3,6 +3,14 @@
        Backported from trunk:
        2025-02-08  Thomas Schwinge  <tschwi...@baylibre.com>
 
+       * lib/gcc-dg.exp (gcc-dg-prune): Turn
+       'sorry, unimplemented: exception handling not supported' into
+       UNSUPPORTED.
+       * gcc.dg/pr104464.c: Remove GCN XFAIL.
+
+       Backported from trunk:
+       2025-02-08  Thomas Schwinge  <tschwi...@baylibre.com>
+
        * gcc.dg/cleanup-12.c: Don't 'dg-skip-if "" { ! nonlocal_goto }'.
        * gcc.dg/cleanup-13.c: Likewise.
        * gcc.dg/cleanup-5.c: Likewise.
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 5f00dd9ef3a1..42c2013d4216 100644
--- a/gcc/testsuite/lib/gcc-dg.exp
+++ b/gcc/testsuite/lib/gcc-dg.exp
@@ -429,6 +429,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/ChangeLog.omp b/libstdc++-v3/ChangeLog.omp
index b5c189ccbb23..79566e975565 100644
--- a/libstdc++-v3/ChangeLog.omp
+++ b/libstdc++-v3/ChangeLog.omp
@@ -3,5 +3,12 @@
        Backported from trunk:
        2025-02-08  Thomas Schwinge  <tschwi...@baylibre.com>
 
+       * testsuite/lib/prune.exp (libstdc++-dg-prune): Turn
+       'sorry, unimplemented: exception handling not supported' into
+       UNSUPPORTED.
+
+       Backported from trunk:
+       2025-02-08  Thomas Schwinge  <tschwi...@baylibre.com>
+
        * testsuite/lib/prune.exp (libstdc++-dg-prune): Clarify
        effective-target 'exceptions_enabled'.
diff --git a/libstdc++-v3/testsuite/lib/prune.exp 
b/libstdc++-v3/testsuite/lib/prune.exp
index 0b69cca2e013..56d16cb2e2cc 100644
--- a/libstdc++-v3/testsuite/lib/prune.exp
+++ b/libstdc++-v3/testsuite/lib/prune.exp
@@ -80,6 +80,13 @@ proc libstdc++-dg-prune { system text } {
     # Ignore dsymutil warning (tool bug is actually in the linker)
     regsub -all "(^|\n)\[^\n\]*could not find object file symbol for 
symbol\[^\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