aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDimitar Dimitrov <dimitar@dinux.eu>2025-01-18 17:10:43 +0200
committerDimitar Dimitrov <dimitar@dinux.eu>2025-04-25 23:07:10 +0300
commit07b29ef00b7bbe985da62159306361faec2c3a20 (patch)
tree5d49bbda56e76281dd31675d9cd4ad482785e234 /gcc
parentc0136555e9974383a0a2256987d24bfbae2f2c10 (diff)
downloadgcc-07b29ef00b7bbe985da62159306361faec2c3a20.zip
gcc-07b29ef00b7bbe985da62159306361faec2c3a20.tar.gz
gcc-07b29ef00b7bbe985da62159306361faec2c3a20.tar.bz2
testsuite: Add require target for SJLJ exception implementation
Testcases for musttail call optimization fail on pru-unknown-elf: FAIL: c-c++-common/musttail14.c -std=gnu++17 (test for excess errors) Excess errors: .../gcc/gcc/testsuite/c-c++-common/musttail14.c:37:14: error: cannot tail-call: caller uses sjlj exceptions Silence these errors by disabling the tests if target uses SJLJ for implementing exceptions. Use a new effective target check for this. Ensured that test results with and without this patch for x86_64-pc-linux-gnu are the same. gcc/ChangeLog: * doc/sourcebuild.texi: Document effective target using_sjlj_exceptions. gcc/testsuite/ChangeLog: * c-c++-common/musttail14.c: Disable test if effective target using_sjlj_exceptions. * c-c++-common/musttail22.c: Ditto. * g++.dg/musttail8.C: Ditto. * g++.dg/musttail9.C: Ditto. * g++.dg/opt/musttail3.C: Ditto. * g++.dg/opt/musttail4.C: Ditto. * g++.dg/opt/musttail5.C: Ditto. * g++.dg/opt/pr119613.C: Ditto. * lib/target-supports.exp (check_effective_target_using_sjlj_exceptions): New check. Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/doc/sourcebuild.texi3
-rw-r--r--gcc/testsuite/c-c++-common/musttail14.c2
-rw-r--r--gcc/testsuite/c-c++-common/musttail22.c2
-rw-r--r--gcc/testsuite/g++.dg/musttail8.C2
-rw-r--r--gcc/testsuite/g++.dg/musttail9.C2
-rw-r--r--gcc/testsuite/g++.dg/opt/musttail3.C2
-rw-r--r--gcc/testsuite/g++.dg/opt/musttail4.C2
-rw-r--r--gcc/testsuite/g++.dg/opt/musttail5.C2
-rw-r--r--gcc/testsuite/g++.dg/opt/pr119613.C2
-rw-r--r--gcc/testsuite/lib/target-supports.exp12
10 files changed, 23 insertions, 8 deletions
diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
index c29cd3f..0bd9873 100644
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -3012,6 +3012,9 @@ Note that this is orthogonal to effective-target @code{exceptions_enabled}.
Testing configuration has exception handling enabled.
Note that this is orthogonal to effective-target @code{exceptions}.
+@item using_sjlj_exceptions
+Target uses @code{setjmp} and @code{longjmp} for implementing exceptions.
+
@item fgraphite
Target supports Graphite optimizations.
diff --git a/gcc/testsuite/c-c++-common/musttail14.c b/gcc/testsuite/c-c++-common/musttail14.c
index 56a52b8..5bda742 100644
--- a/gcc/testsuite/c-c++-common/musttail14.c
+++ b/gcc/testsuite/c-c++-common/musttail14.c
@@ -1,5 +1,5 @@
/* PR tree-optimization/118430 */
-/* { dg-do compile { target musttail } } */
+/* { dg-do compile { target { musttail && { ! using_sjlj_exceptions } } } } */
/* { dg-options "-O2 -fdump-tree-optimized" } */
/* { dg-final { scan-tree-dump-times " \[^\n\r]* = bar \\\(\[^\n\r]*\\\); \\\[tail call\\\] \\\[must tail call\\\]" 1 "optimized" } } */
/* { dg-final { scan-tree-dump-times " \[^\n\r]* = freddy \\\(\[^\n\r]*\\\); \\\[tail call\\\] \\\[must tail call\\\]" 1 "optimized" } } */
diff --git a/gcc/testsuite/c-c++-common/musttail22.c b/gcc/testsuite/c-c++-common/musttail22.c
index eb81249..7dc0f19 100644
--- a/gcc/testsuite/c-c++-common/musttail22.c
+++ b/gcc/testsuite/c-c++-common/musttail22.c
@@ -1,5 +1,5 @@
/* PR tree-optimization/118430 */
-/* { dg-do compile { target musttail } } */
+/* { dg-do compile { target { musttail && { ! using_sjlj_exceptions } } } } */
/* { dg-options "-O2 -fdump-tree-optimized" } */
/* { dg-final { scan-tree-dump-times " \[^\n\r]* = bar \\\(\[^\n\r]*\\\); \\\[tail call\\\] \\\[must tail call\\\]" 1 "optimized" } } */
/* { dg-final { scan-tree-dump-times " \[^\n\r]* = freddy \\\(\[^\n\r]*\\\); \\\[tail call\\\] \\\[must tail call\\\]" 1 "optimized" } } */
diff --git a/gcc/testsuite/g++.dg/musttail8.C b/gcc/testsuite/g++.dg/musttail8.C
index 0f1b68b..18de9c8 100644
--- a/gcc/testsuite/g++.dg/musttail8.C
+++ b/gcc/testsuite/g++.dg/musttail8.C
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { musttail } } } */
+/* { dg-do compile { target { musttail && { ! using_sjlj_exceptions } } } } */
/* { dg-options "-std=gnu++11" } */
/* { dg-additional-options "-fdelayed-branch" { target sparc*-*-* } } */
diff --git a/gcc/testsuite/g++.dg/musttail9.C b/gcc/testsuite/g++.dg/musttail9.C
index 85937dc..1c3a744 100644
--- a/gcc/testsuite/g++.dg/musttail9.C
+++ b/gcc/testsuite/g++.dg/musttail9.C
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { musttail } } } */
+/* { dg-do compile { target { musttail && { ! using_sjlj_exceptions } } } } */
/* { dg-options "-std=gnu++11" } */
/* { dg-additional-options "-fdelayed-branch" { target sparc*-*-* } } */
diff --git a/gcc/testsuite/g++.dg/opt/musttail3.C b/gcc/testsuite/g++.dg/opt/musttail3.C
index 1c4e549..a2db447 100644
--- a/gcc/testsuite/g++.dg/opt/musttail3.C
+++ b/gcc/testsuite/g++.dg/opt/musttail3.C
@@ -1,5 +1,5 @@
// PR tree-optimization/119491
-// { dg-do compile { target { external_musttail && c++11 } } }
+// { dg-do compile { target { external_musttail && { c++11 && { ! using_sjlj_exceptions } } } } }
// { dg-options "-O2" }
struct A {
diff --git a/gcc/testsuite/g++.dg/opt/musttail4.C b/gcc/testsuite/g++.dg/opt/musttail4.C
index ede2959..3362ccc 100644
--- a/gcc/testsuite/g++.dg/opt/musttail4.C
+++ b/gcc/testsuite/g++.dg/opt/musttail4.C
@@ -1,4 +1,4 @@
-// { dg-do compile { target { external_musttail && c++11 } } }
+// { dg-do compile { target { external_musttail && { c++11 && { ! using_sjlj_exceptions } } } } }
// { dg-options "-O2 -fexceptions" }
struct S { ~S (); };
diff --git a/gcc/testsuite/g++.dg/opt/musttail5.C b/gcc/testsuite/g++.dg/opt/musttail5.C
index 604dd69..10e8d94 100644
--- a/gcc/testsuite/g++.dg/opt/musttail5.C
+++ b/gcc/testsuite/g++.dg/opt/musttail5.C
@@ -1,5 +1,5 @@
// PR tree-optimization/119491
-// { dg-do compile { target { external_musttail && c++11 } } }
+// { dg-do compile { target { external_musttail && { c++11 && { ! using_sjlj_exceptions } } } } }
// { dg-options "-O2" }
struct A {
diff --git a/gcc/testsuite/g++.dg/opt/pr119613.C b/gcc/testsuite/g++.dg/opt/pr119613.C
index 2ced2e8..c3657eb 100644
--- a/gcc/testsuite/g++.dg/opt/pr119613.C
+++ b/gcc/testsuite/g++.dg/opt/pr119613.C
@@ -1,5 +1,5 @@
// PR middle-end/119613
-// { dg-do compile { target { musttail && c++11 } } }
+// { dg-do compile { target { musttail && { c++11 && { ! using_sjlj_exceptions } } } } }
// { dg-options "-O0" }
struct S { S () {} };
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 869d150..16bb2ae 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -12632,6 +12632,18 @@ proc check_effective_target_exceptions_enabled {} {
}]
}
+# Returns 1 if target uses setjump/longjump for implementing exceptions,
+# 0 otherwise.
+proc check_effective_target_using_sjlj_exceptions {} {
+ return [check_no_compiler_messages using_sjlj_exceptions assembly {
+ // C++
+ #if !defined __USING_SJLJ_EXCEPTIONS__
+ #error not using SJLJ exception implementation
+ #endif
+ int dummy;
+ }]
+}
+
proc check_effective_target_tiny {} {
return [check_cached_effective_target tiny {
if { [istarget aarch64*-*-*]