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.
This commit is contained in:
Thomas Schwinge 2025-01-28 14:57:21 +01:00
parent 7809aa1128
commit 6312165650
5 changed files with 28 additions and 2 deletions

View file

@ -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

View file

@ -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 "" "")

View file

@ -9,5 +9,3 @@ foo(void)
{
f += (F)(f != (F){}[0]);
}
/* { dg-xfail-if "-fnon-call-exceptions unsupported" { amdgcn-*-* } } */

View file

@ -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] {

View file

@ -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] {