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. Ok for trunk? 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 <dimi...@dinux.eu> --- gcc/testsuite/c-c++-common/musttail14.c | 2 +- gcc/testsuite/c-c++-common/musttail22.c | 2 +- gcc/testsuite/g++.dg/musttail8.C | 2 +- gcc/testsuite/g++.dg/musttail9.C | 2 +- gcc/testsuite/g++.dg/opt/musttail3.C | 2 +- gcc/testsuite/g++.dg/opt/musttail4.C | 2 +- gcc/testsuite/g++.dg/opt/musttail5.C | 2 +- gcc/testsuite/g++.dg/opt/pr119613.C | 2 +- gcc/testsuite/lib/target-supports.exp | 12 ++++++++++++ 9 files changed, 20 insertions(+), 8 deletions(-) diff --git a/gcc/testsuite/c-c++-common/musttail14.c b/gcc/testsuite/c-c++-common/musttail14.c index 56a52b8638b..5bda742b36f 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 eb812494f44..7dc0f199ea9 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 0f1b68bd269..18de9c87935 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 85937dcdcd3..1c3a744a4e4 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 1c4e54952b1..a2db4479ec1 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 ede2959f7d7..3362ccc5e01 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 604dd6907aa..10e8d940dbb 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 2ced2e8fa2a..c3657eb4f98 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 869d1501c38..16bb2ae4426 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*-*-*] -- 2.49.0