public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Support 'UNSUPPORTED: [...]: exception handling disabled' for libstdc++ testing (was: Support in the GCC(/C++) test suites for '-fno-exceptions')
       [not found] ` <CACb0b4kDiwp5nEY952rbLAKy7_+iJey71z3WNMUxahTaLQt6vA@mail.gmail.com>
@ 2023-06-07  7:13   ` Thomas Schwinge
  2023-06-07  8:12     ` Jonathan Wakely
  2023-06-15 15:15   ` Skip a number of C++ test cases for '-fno-exceptions' " Thomas Schwinge
  1 sibling, 1 reply; 14+ messages in thread
From: Thomas Schwinge @ 2023-06-07  7:13 UTC (permalink / raw)
  To: Jonathan Wakely, gcc-patches, libstdc++; +Cc: Jozef Lawrynowicz

[-- Attachment #1: Type: text/plain, Size: 7593 bytes --]

Hi!

On 2023-06-06T20:31:21+0100, Jonathan Wakely <jwakely@redhat.com> wrote:
> On Tue, 6 Jun 2023 at 20:14, Thomas Schwinge <thomas@codesourcery.com>
> wrote:
>> This issue comes up in context of me working on C++ support for GCN and
>> nvptx target.  Those targets shall default to '-fno-exceptions' -- or,
>> "in other words", '-fexceptions' is not supported.  (Details omitted
>> here.)
>>
>> It did seem clear to me that with such a configuration it'll be hard to
>> get clean test results.  Then I found code in
>> 'gcc/testsuite/lib/gcc-dg.exp:gcc-dg-prune':
>>
>>     # If exceptions are disabled, mark tests expecting exceptions to be
>> enabled
>>     # as unsupported.
>>     if { ![check_effective_target_exceptions_enabled] } {
>>         if [regexp "(^|\n)\[^\n\]*: error: exception handling disabled"
>> $text] {
>>             return "::unsupported::exception handling disabled"
>>         }
>>
>> ..., which, in a way, sounds as if the test suite generally is meant to
>> produce useful results for '-fno-exceptions', nice surprise!
>>
>> Running x86_64-pc-linux-gnu (not yet GCN, nvptx) 'make check' with:
>>
>>     RUNTESTFLAGS='--target_board=unix/-fno-exceptions\{,-m32\}'
>>
>> ..., I find that indeed this does work for a lot of test cases, where we
>> then get (random example):
>>
>>      PASS: g++.dg/coroutines/pr99710.C  (test for errors, line 23)
>>     -PASS: g++.dg/coroutines/pr99710.C (test for excess errors)
>>     +UNSUPPORTED: g++.dg/coroutines/pr99710.C: exception handling disabled
>>
>> ..., due to:
>>
>>      [...]/g++.dg/coroutines/pr99710.C: In function 'task my_coro()':
>>     +[...]/g++.dg/coroutines/pr99710.C:18:10: error: exception handling
>> disabled, use '-fexceptions' to enable
>>      [...]/g++.dg/coroutines/pr99710.C:23:7: error: await expressions are
>> not permitted in handlers
>>      compiler exited with status 1
>>
>> But, we're nowhere near clean test results: PASS -> FAIL as well as
>> XFAIL -> XPASS regressions, due to 'error: exception handling disabled'
>> precluding other diagnostics seems to be one major issue.
>>
>> Is there interest in me producing the obvious (?) changes to those test
>> cases, such that compiler g++ as well as target library libstdc++ test
>> results are reasonably clean?  (If you think that's all "wasted effort",
>> then I suppose I'll just locally ignore any FAILs/XPASSes/UNRESOLVEDs
>> that appear in combination with
>> 'UNSUPPORTED: [...]: exception handling disabled'.)
>
> I would welcome that for libstdc++.

Assuming no issues found in testing, OK to push the attached
"Support 'UNSUPPORTED: [...]: exception handling disabled' for libstdc++ testing"?
(Thanks, Jozef!)

> I do sometimes run the libstdc++ tests
> with "unusual" options, like -fno-exceptions and -fno-rtti (e.g. today I've
> been fixing FAILs that only happen with -fexcess-precision=standard). I
> just manually ignore the tests that fail for -fno-exceptions, but it would
> be great if they were automatically skipped as UNSUPPORTED.
>
> We already have a handful of tests that use #if __cpp_exceptions to make
> those parts conditional on exception support. We also have exactly one test
> that is currently UNSUPPORTED when -fno-exceptions is used:
> testsuite/18_support/nested_exception/rethrow_if_nested-term.cc:// {
> dg-skip-if "" { *-*-* } { "-fno-exceptions" } }

ACK -- that'll only work for explicit '-fno-exceptions', but not for
implicit (say, via 'CC1PLUS_SPEC'), right?  So, indeed:

> That could be changed to use an effective target keyword instead.

I'll look into that later.

> To add an effective-target to the libstdc++ testsuite would be as simple as:
>
> --- a/libstdc++-v3/testsuite/lib/libstdc++.exp
> +++ b/libstdc++-v3/testsuite/lib/libstdc++.exp
> @@ -1421,6 +1421,14 @@ proc check_effective_target_tzdb { } {
>     }]
> }
>
> +# Return 1 if exception handling is enabled.
> +proc check_effective_target_exceptions_enabled { } {
> +    return [check_v3_target_prop_cached et_eh {
> +       set cond "defined __cpp_exceptions"
> +       return [v3_check_preprocessor_condition eh $cond]
> +    }]
> +}
> +

Well, we don't even need to do that, because:

> However, you probably want to add it to the main testsuite instead, which
> would be a little more involved (the v3_check_preprocessor_condition proc
> is specific to libstdc++).

..., this has already been done in Subversion r279246
(Git commit a9046e9853024206bec092dd63e21e152cb5cbca)
"[MSP430] -Add fno-exceptions multilib" (thanks, Jozef!):

    --- gcc/testsuite/lib/target-supports.exp
    +++ gcc/testsuite/lib/target-supports.exp
    @@ -8990,6 +8990,24 @@ proc check_effective_target_exceptions {} {
         return 1
     }

    +# Used to check if the testing configuration supports exceptions.
    +# Returns 0 if exceptions are unsupported or disabled (e.g. by passing
    +# -fno-exceptions). Returns 1 if exceptions are enabled.
    +proc check_effective_target_exceptions_enabled {} {
    +    return [check_cached_effective_target exceptions_enabled {
    +   if { [check_effective_target_exceptions] } {
    +       return [check_no_compiler_messages exceptions_enabled assembly {
    +           void foo (void)
    +           {
    +               throw 1;
    +           }
    +       }]
    +   } else {
    +       # If exceptions aren't supported, then they're not enabled.
    +       return 0
    +   }
    +    }]
    +}

     proc check_effective_target_tiny {} {
         return [check_cached_effective_target tiny {

..., and it even already has one usage in libstdc++, per your
commit 4c27c6584d0c15926f57ac40f931e238cf0b3110
"libstdc++: Make testsuite usable with -fno-exceptions":

    --- libstdc++-v3/testsuite/23_containers/vector/bool/72847.cc
    +++ libstdc++-v3/testsuite/23_containers/vector/bool/72847.cc
    @@ -15,7 +15,7 @@
     // with this library; see the file COPYING3.  If not see
     // <http://www.gnu.org/licenses/>.

    -// { dg-skip-if "" { *-*-* } { "-fno-exceptions" } }
    +// { dg-require-effective-target exceptions_enabled }

     #include <vector>
     #include <ext/throw_allocator.h>

;-)


Grüße
 Thomas


>> For a start, the libstdc++ test suite needs
>> 'UNSUPPORTED: [...]: exception handling disabled' enabled/ported.  (I'll
>> do that.)  Otherwise, a number of test cases need DejaGnu directives
>> conditionalized on 'target exceptions_enabled'.  (Or,
>> 'error: exception handling disabled' made a "really late" diagnostic, so
>> that it doesn't preclude other diagnostics?  I'll have a look.  Well,
>> maybe something like: in fact do not default to '-fno-exceptions', but
>> instead emit 'error: exception handling disabled' only if in a "really
>> late" pass we run into exceptions-related constructs that we cannot
>> support.  That'd also avoid PASS -> UNSUPPORTED "regressions" when
>> exception handling in fact gets optimized away, for example.  I like that
>> idea, conceptually -- but is it feasible to implement..?)
>>
>
> IMHO just defining an effective target keyword and then using that in test
> selectors seems simpler, and doesn't require changes to the compiler, just
> the tests.


-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Support-UNSUPPORTED-.-exception-handling-disabled-fo.patch --]
[-- Type: text/x-diff, Size: 1880 bytes --]

From d12157a17683ff400f911751e2f2d74394f9ff5d Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Wed, 7 Jun 2023 08:46:38 +0200
Subject: [PATCH] Support 'UNSUPPORTED: [...]: exception handling disabled' for
 libstdc++ testing

Verbatim copy of what was added to 'gcc/testsuite/lib/gcc-dg.exp:gcc-dg-prune'
in Subversion r279246 (Git commit a9046e9853024206bec092dd63e21e152cb5cbca)
"[MSP430] -Add fno-exceptions multilib".

This greatly improves 'make check-target-libstdc++-v3' results for, for
example, x86_64-pc-linux-gnu with:

    RUNTESTFLAGS='--target_board=unix/-fno-exceptions\{,-m32\}'

	libstdc++-v3/
	* testsuite/lib/prune.exp (libstdc++-dg-prune): Support
	'UNSUPPORTED: [...]: exception handling disabled'.
---
 libstdc++-v3/testsuite/lib/prune.exp | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/libstdc++-v3/testsuite/lib/prune.exp b/libstdc++-v3/testsuite/lib/prune.exp
index 2d2349e7cba..be6d16c26e5 100644
--- a/libstdc++-v3/testsuite/lib/prune.exp
+++ b/libstdc++-v3/testsuite/lib/prune.exp
@@ -79,6 +79,18 @@ 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 exceptions are disabled, mark tests expecting exceptions to be enabled
+    # as unsupported.
+    if { ![check_effective_target_exceptions_enabled] } {
+	if [regexp "(^|\n)\[^\n\]*: error: exception handling disabled" $text] {
+	    return "::unsupported::exception handling disabled"
+	}
+
+	if [regexp "(^|\n)\[^\n\]*: error: #error .__cpp_exceptions." $text] {
+	    return "::unsupported::exception handling disabled"
+	}
+    }
+
     foreach p $additional_prunes {
 	if { [string length $p] > 0 } {
 	    # Following regexp matches a complete line containing $p.
-- 
2.34.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Support 'UNSUPPORTED: [...]: exception handling disabled' for libstdc++ testing (was: Support in the GCC(/C++) test suites for '-fno-exceptions')
  2023-06-07  7:13   ` Support 'UNSUPPORTED: [...]: exception handling disabled' for libstdc++ testing (was: Support in the GCC(/C++) test suites for '-fno-exceptions') Thomas Schwinge
@ 2023-06-07  8:12     ` Jonathan Wakely
  2023-06-07  9:08       ` Thomas Schwinge
  0 siblings, 1 reply; 14+ messages in thread
From: Jonathan Wakely @ 2023-06-07  8:12 UTC (permalink / raw)
  To: Thomas Schwinge; +Cc: gcc-patches, libstdc++, Jozef Lawrynowicz

[-- Attachment #1: Type: text/plain, Size: 6661 bytes --]

On Wed, 7 Jun 2023 at 08:13, Thomas Schwinge wrote:

> Hi!
>
> On 2023-06-06T20:31:21+0100, Jonathan Wakely <jwakely@redhat.com> wrote:
> > On Tue, 6 Jun 2023 at 20:14, Thomas Schwinge <thomas@codesourcery.com>
> > wrote:
> >> This issue comes up in context of me working on C++ support for GCN and
> >> nvptx target.  Those targets shall default to '-fno-exceptions' -- or,
> >> "in other words", '-fexceptions' is not supported.  (Details omitted
> >> here.)
> >>
> >> It did seem clear to me that with such a configuration it'll be hard to
> >> get clean test results.  Then I found code in
> >> 'gcc/testsuite/lib/gcc-dg.exp:gcc-dg-prune':
> >>
> >>     # If exceptions are disabled, mark tests expecting exceptions to be
> >> enabled
> >>     # as unsupported.
> >>     if { ![check_effective_target_exceptions_enabled] } {
> >>         if [regexp "(^|\n)\[^\n\]*: error: exception handling disabled"
> >> $text] {
> >>             return "::unsupported::exception handling disabled"
> >>         }
> >>
> >> ..., which, in a way, sounds as if the test suite generally is meant to
> >> produce useful results for '-fno-exceptions', nice surprise!
> >>
> >> Running x86_64-pc-linux-gnu (not yet GCN, nvptx) 'make check' with:
> >>
> >>     RUNTESTFLAGS='--target_board=unix/-fno-exceptions\{,-m32\}'
> >>
> >> ..., I find that indeed this does work for a lot of test cases, where we
> >> then get (random example):
> >>
> >>      PASS: g++.dg/coroutines/pr99710.C  (test for errors, line 23)
> >>     -PASS: g++.dg/coroutines/pr99710.C (test for excess errors)
> >>     +UNSUPPORTED: g++.dg/coroutines/pr99710.C: exception handling
> disabled
> >>
> >> ..., due to:
> >>
> >>      [...]/g++.dg/coroutines/pr99710.C: In function 'task my_coro()':
> >>     +[...]/g++.dg/coroutines/pr99710.C:18:10: error: exception handling
> >> disabled, use '-fexceptions' to enable
> >>      [...]/g++.dg/coroutines/pr99710.C:23:7: error: await expressions
> are
> >> not permitted in handlers
> >>      compiler exited with status 1
> >>
> >> But, we're nowhere near clean test results: PASS -> FAIL as well as
> >> XFAIL -> XPASS regressions, due to 'error: exception handling disabled'
> >> precluding other diagnostics seems to be one major issue.
> >>
> >> Is there interest in me producing the obvious (?) changes to those test
> >> cases, such that compiler g++ as well as target library libstdc++ test
> >> results are reasonably clean?  (If you think that's all "wasted effort",
> >> then I suppose I'll just locally ignore any FAILs/XPASSes/UNRESOLVEDs
> >> that appear in combination with
> >> 'UNSUPPORTED: [...]: exception handling disabled'.)
> >
> > I would welcome that for libstdc++.
>
> Assuming no issues found in testing, OK to push the attached
> "Support 'UNSUPPORTED: [...]: exception handling disabled' for libstdc++
> testing"?
> (Thanks, Jozef!)
>

Yes please.


>
> > I do sometimes run the libstdc++ tests
> > with "unusual" options, like -fno-exceptions and -fno-rtti (e.g. today
> I've
> > been fixing FAILs that only happen with -fexcess-precision=standard). I
> > just manually ignore the tests that fail for -fno-exceptions, but it
> would
> > be great if they were automatically skipped as UNSUPPORTED.
> >
> > We already have a handful of tests that use #if __cpp_exceptions to make
> > those parts conditional on exception support. We also have exactly one
> test
> > that is currently UNSUPPORTED when -fno-exceptions is used:
> > testsuite/18_support/nested_exception/rethrow_if_nested-term.cc:// {
> > dg-skip-if "" { *-*-* } { "-fno-exceptions" } }
>
> ACK -- that'll only work for explicit '-fno-exceptions', but not for
> implicit (say, via 'CC1PLUS_SPEC'), right?


That's right.



> So, indeed:
>
> > That could be changed to use an effective target keyword instead.
>
> I'll look into that later.
>
> > To add an effective-target to the libstdc++ testsuite would be as simple
> as:
> >
> > --- a/libstdc++-v3/testsuite/lib/libstdc++.exp
> > +++ b/libstdc++-v3/testsuite/lib/libstdc++.exp
> > @@ -1421,6 +1421,14 @@ proc check_effective_target_tzdb { } {
> >     }]
> > }
> >
> > +# Return 1 if exception handling is enabled.
> > +proc check_effective_target_exceptions_enabled { } {
> > +    return [check_v3_target_prop_cached et_eh {
> > +       set cond "defined __cpp_exceptions"
> > +       return [v3_check_preprocessor_condition eh $cond]
> > +    }]
> > +}
> > +
>
> Well, we don't even need to do that, because:
>
> > However, you probably want to add it to the main testsuite instead, which
> > would be a little more involved (the v3_check_preprocessor_condition proc
> > is specific to libstdc++).
>
> ..., this has already been done in Subversion r279246
> (Git commit a9046e9853024206bec092dd63e21e152cb5cbca)
> "[MSP430] -Add fno-exceptions multilib" (thanks, Jozef!):
>

Nice.


>
>     --- gcc/testsuite/lib/target-supports.exp
>     +++ gcc/testsuite/lib/target-supports.exp
>     @@ -8990,6 +8990,24 @@ proc check_effective_target_exceptions {} {
>          return 1
>      }
>
>     +# Used to check if the testing configuration supports exceptions.
>     +# Returns 0 if exceptions are unsupported or disabled (e.g. by passing
>     +# -fno-exceptions). Returns 1 if exceptions are enabled.
>     +proc check_effective_target_exceptions_enabled {} {
>     +    return [check_cached_effective_target exceptions_enabled {
>     +   if { [check_effective_target_exceptions] } {
>     +       return [check_no_compiler_messages exceptions_enabled assembly
> {
>     +           void foo (void)
>     +           {
>     +               throw 1;
>     +           }
>     +       }]
>     +   } else {
>     +       # If exceptions aren't supported, then they're not enabled.
>     +       return 0
>     +   }
>     +    }]
>     +}
>
>      proc check_effective_target_tiny {} {
>          return [check_cached_effective_target tiny {
>
> ..., and it even already has one usage in libstdc++, per your
> commit 4c27c6584d0c15926f57ac40f931e238cf0b3110
> "libstdc++: Make testsuite usable with -fno-exceptions":
>
>     --- libstdc++-v3/testsuite/23_containers/vector/bool/72847.cc
>     +++ libstdc++-v3/testsuite/23_containers/vector/bool/72847.cc
>     @@ -15,7 +15,7 @@
>      // with this library; see the file COPYING3.  If not see
>      // <http://www.gnu.org/licenses/>.
>
>     -// { dg-skip-if "" { *-*-* } { "-fno-exceptions" } }
>     +// { dg-require-effective-target exceptions_enabled }
>
>      #include <vector>
>      #include <ext/throw_allocator.h>
>
> ;-)
>
>
Ha! I forgot all about that.

I'll change the rethrow_if_nested-term.cc test to the the effective target
instead of dg-skip-if.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Support 'UNSUPPORTED: [...]: exception handling disabled' for libstdc++ testing (was: Support in the GCC(/C++) test suites for '-fno-exceptions')
  2023-06-07  8:12     ` Jonathan Wakely
@ 2023-06-07  9:08       ` Thomas Schwinge
  2023-06-07 11:51         ` Jonathan Wakely
  0 siblings, 1 reply; 14+ messages in thread
From: Thomas Schwinge @ 2023-06-07  9:08 UTC (permalink / raw)
  To: Jonathan Wakely, gcc-patches, libstdc++; +Cc: Jozef Lawrynowicz

Hi!

On 2023-06-07T09:12:31+0100, Jonathan Wakely <jwakely@redhat.com> wrote:
> On Wed, 7 Jun 2023 at 08:13, Thomas Schwinge wrote:
>> On 2023-06-06T20:31:21+0100, Jonathan Wakely <jwakely@redhat.com> wrote:
>> > On Tue, 6 Jun 2023 at 20:14, Thomas Schwinge <thomas@codesourcery.com>
>> > wrote:
>> >> This issue comes up in context of me working on C++ support for GCN and
>> >> nvptx target.  Those targets shall default to '-fno-exceptions' -- or,
>> >> "in other words", '-fexceptions' is not supported.  (Details omitted
>> >> here.)
>> >>
>> >> It did seem clear to me that with such a configuration it'll be hard to
>> >> get clean test results.  Then I found code in
>> >> 'gcc/testsuite/lib/gcc-dg.exp:gcc-dg-prune':
>> >>
>> >>     # If exceptions are disabled, mark tests expecting exceptions to be
>> >> enabled
>> >>     # as unsupported.
>> >>     if { ![check_effective_target_exceptions_enabled] } {
>> >>         if [regexp "(^|\n)\[^\n\]*: error: exception handling disabled"
>> >> $text] {
>> >>             return "::unsupported::exception handling disabled"
>> >>         }
>> >>
>> >> ..., which, in a way, sounds as if the test suite generally is meant to
>> >> produce useful results for '-fno-exceptions', nice surprise!
>> >>
>> >> Running x86_64-pc-linux-gnu (not yet GCN, nvptx) 'make check' with:
>> >>
>> >>     RUNTESTFLAGS='--target_board=unix/-fno-exceptions\{,-m32\}'
>> >>
>> >> ..., I find that indeed this does work for a lot of test cases, where we
>> >> then get (random example):
>> >>
>> >>      PASS: g++.dg/coroutines/pr99710.C  (test for errors, line 23)
>> >>     -PASS: g++.dg/coroutines/pr99710.C (test for excess errors)
>> >>     +UNSUPPORTED: g++.dg/coroutines/pr99710.C: exception handling
>> disabled
>> >>
>> >> ..., due to:
>> >>
>> >>      [...]/g++.dg/coroutines/pr99710.C: In function 'task my_coro()':
>> >>     +[...]/g++.dg/coroutines/pr99710.C:18:10: error: exception handling
>> >> disabled, use '-fexceptions' to enable
>> >>      [...]/g++.dg/coroutines/pr99710.C:23:7: error: await expressions
>> are
>> >> not permitted in handlers
>> >>      compiler exited with status 1
>> >>
>> >> But, we're nowhere near clean test results: PASS -> FAIL as well as
>> >> XFAIL -> XPASS regressions, due to 'error: exception handling disabled'
>> >> precluding other diagnostics seems to be one major issue.
>> >>
>> >> Is there interest in me producing the obvious (?) changes to those test
>> >> cases, such that compiler g++ as well as target library libstdc++ test
>> >> results are reasonably clean?  (If you think that's all "wasted effort",
>> >> then I suppose I'll just locally ignore any FAILs/XPASSes/UNRESOLVEDs
>> >> that appear in combination with
>> >> 'UNSUPPORTED: [...]: exception handling disabled'.)
>> >
>> > I would welcome that for libstdc++.
>>
>> Assuming no issues found in testing, OK to push the attached
>> "Support 'UNSUPPORTED: [...]: exception handling disabled' for libstdc++
>> testing"?
>> (Thanks, Jozef!)
>
> Yes please.

Pushed commit r14-1604-g5faaabef3819434d13fcbf749bd07bfc98ca7c3c
"Support 'UNSUPPORTED: [...]: exception handling disabled' for libstdc++ testing"
to master branch, as posted.

For one-week-old GCC commit 2720bbd597f56742a17119dfe80edc2ba86af255,
x86_64-pc-linux-gnu, I see no changes without '-fno-exceptions' (as
expected), and otherwise:

                    === libstdc++ Summary for [-unix-]{+unix/-fno-exceptions+} ===

    # of expected passes            [-15044-]{+12877+}
    # of unexpected failures        [-5-]{+10+}
    # of expected failures          [-106-]{+77+}
    {+# of unresolved testcases     6+}
    # of unsupported tests          [-747-]{+1846+}

As expected, there's a good number of (random example):

    -PASS: 18_support/105387.cc (test for excess errors)
    -PASS: 18_support/105387.cc execution test
    +UNSUPPORTED: 18_support/105387.cc: exception handling disabled

..., plus the following:

    [-PASS:-]{+FAIL:+} 23_containers/vector/capacity/constexpr.cc (test for excess errors)

    [...]/libstdc++-v3/testsuite/23_containers/vector/capacity/constexpr.cc:101: error: non-constant condition for static assertion
    In file included from [...]/libstdc++-v3/testsuite/23_containers/vector/capacity/constexpr.cc:6:
    [...]/libstdc++-v3/testsuite/23_containers/vector/capacity/constexpr.cc:101:   in 'constexpr' expansion of 'test_shrink_to_fit()'
    [...]/libstdc++-v3/testsuite/util/testsuite_hooks.h:56: error: '__builtin_fprintf(stderr, ((const char*)"%s:%d: %s: Assertion \'%s\' failed.\012"), ((const char*)"[...]/libstdc++-v3/testsuite/23_containers/vector/capacity/constexpr.cc"), 92, ((const char*)"constexpr bool test_shrink_to_fit()"), ((const char*)"v.capacity() == 0"))' is not a constant expression
    [...]/libstdc++-v3/testsuite/util/testsuite_hooks.h:66: note: in expansion of macro '_VERIFY_PRINT'
    [...]/libstdc++-v3/testsuite/23_containers/vector/capacity/constexpr.cc:92: note: in expansion of macro 'VERIFY'
    compiler exited with status 1

..., and:

    PASS: 23_containers/vector/capacity/shrink_to_fit.cc (test for excess errors)
    [-PASS:-]{+FAIL:+} 23_containers/vector/capacity/shrink_to_fit.cc execution test

    [...]/libstdc++-v3/testsuite/23_containers/vector/capacity/shrink_to_fit.cc:33: void test01(): Assertion 'v.size() == v.capacity()' failed.

..., and:

    PASS: 27_io/basic_ostream/inserters_arithmetic/pod/23875.cc (test for excess errors)
    [-PASS:-]{+FAIL:+} 27_io/basic_ostream/inserters_arithmetic/pod/23875.cc execution test

    terminate called after throwing an instance of 'std::bad_cast'
      what():  std::bad_cast

..., and:

    [-PASS:-]{+FAIL:+} ext/bitmap_allocator/check_allocate_max_size.cc (test for excess errors)
    [-PASS:-]{+UNRESOLVED:+} ext/bitmap_allocator/check_allocate_max_size.cc [-execution test-]{+compilation failed to produce executable+}

    [...]/libstdc++-v3/testsuite/ext/bitmap_allocator/check_allocate_max_size.cc: In function 'int main()':
    [...]/libstdc++-v3/testsuite/ext/bitmap_allocator/check_allocate_max_size.cc:29: error: 'check_allocate_max_size' is not a member of '__gnu_test'
    [...]/libstdc++-v3/testsuite/ext/bitmap_allocator/check_allocate_max_size.cc:29: error: expected primary-expression before '>' token
    [...]/libstdc++-v3/testsuite/ext/bitmap_allocator/check_allocate_max_size.cc:29: error: expected primary-expression before ')' token

..., and similarly:

    [-PASS:-]{+FAIL:+} ext/malloc_allocator/check_allocate_max_size.cc (test for excess errors)
    [-PASS:-]{+UNRESOLVED:+} ext/malloc_allocator/check_allocate_max_size.cc [-execution test-]{+compilation failed to produce executable+}

    [-PASS:-]{+FAIL:+} ext/mt_allocator/check_allocate_max_size.cc (test for excess errors)
    [-PASS:-]{+UNRESOLVED:+} ext/mt_allocator/check_allocate_max_size.cc [-execution test-]{+compilation failed to produce executable+}

    [-PASS:-]{+FAIL:+} ext/new_allocator/check_allocate_max_size.cc (test for excess errors)
    [-PASS:-]{+UNRESOLVED:+} ext/new_allocator/check_allocate_max_size.cc [-execution test-]{+compilation failed to produce executable+}

    [-PASS:-]{+FAIL:+} ext/pool_allocator/check_allocate_max_size.cc (test for excess errors)
    [-PASS:-]{+UNRESOLVED:+} ext/pool_allocator/check_allocate_max_size.cc [-execution test-]{+compilation failed to produce executable+}

    [-PASS:-]{+FAIL:+} ext/throw_allocator/check_allocate_max_size.cc (test for excess errors)
    [-PASS:-]{+UNRESOLVED:+} ext/throw_allocator/check_allocate_max_size.cc [-execution test-]{+compilation failed to produce executable+}

That's all!  :-)

Given my limited C++ language and libstdc++ implementation skills, it's
probably more effective if you address these?  But I'll of course give it
a try if you'd like me to.


Grüße
 Thomas


>> > I do sometimes run the libstdc++ tests
>> > with "unusual" options, like -fno-exceptions and -fno-rtti (e.g. today
>> I've
>> > been fixing FAILs that only happen with -fexcess-precision=standard). I
>> > just manually ignore the tests that fail for -fno-exceptions, but it
>> would
>> > be great if they were automatically skipped as UNSUPPORTED.
>> >
>> > We already have a handful of tests that use #if __cpp_exceptions to make
>> > those parts conditional on exception support. We also have exactly one
>> test
>> > that is currently UNSUPPORTED when -fno-exceptions is used:
>> > testsuite/18_support/nested_exception/rethrow_if_nested-term.cc:// {
>> > dg-skip-if "" { *-*-* } { "-fno-exceptions" } }
>>
>> ACK -- that'll only work for explicit '-fno-exceptions', but not for
>> implicit (say, via 'CC1PLUS_SPEC'), right?
>
>
> That's right.
>
>
>
>> So, indeed:
>>
>> > That could be changed to use an effective target keyword instead.
>>
>> I'll look into that later.
>>
>> > To add an effective-target to the libstdc++ testsuite would be as simple
>> as:
>> >
>> > --- a/libstdc++-v3/testsuite/lib/libstdc++.exp
>> > +++ b/libstdc++-v3/testsuite/lib/libstdc++.exp
>> > @@ -1421,6 +1421,14 @@ proc check_effective_target_tzdb { } {
>> >     }]
>> > }
>> >
>> > +# Return 1 if exception handling is enabled.
>> > +proc check_effective_target_exceptions_enabled { } {
>> > +    return [check_v3_target_prop_cached et_eh {
>> > +       set cond "defined __cpp_exceptions"
>> > +       return [v3_check_preprocessor_condition eh $cond]
>> > +    }]
>> > +}
>> > +
>>
>> Well, we don't even need to do that, because:
>>
>> > However, you probably want to add it to the main testsuite instead, which
>> > would be a little more involved (the v3_check_preprocessor_condition proc
>> > is specific to libstdc++).
>>
>> ..., this has already been done in Subversion r279246
>> (Git commit a9046e9853024206bec092dd63e21e152cb5cbca)
>> "[MSP430] -Add fno-exceptions multilib" (thanks, Jozef!):
>>
>
> Nice.
>
>
>>
>>     --- gcc/testsuite/lib/target-supports.exp
>>     +++ gcc/testsuite/lib/target-supports.exp
>>     @@ -8990,6 +8990,24 @@ proc check_effective_target_exceptions {} {
>>          return 1
>>      }
>>
>>     +# Used to check if the testing configuration supports exceptions.
>>     +# Returns 0 if exceptions are unsupported or disabled (e.g. by passing
>>     +# -fno-exceptions). Returns 1 if exceptions are enabled.
>>     +proc check_effective_target_exceptions_enabled {} {
>>     +    return [check_cached_effective_target exceptions_enabled {
>>     +   if { [check_effective_target_exceptions] } {
>>     +       return [check_no_compiler_messages exceptions_enabled assembly
>> {
>>     +           void foo (void)
>>     +           {
>>     +               throw 1;
>>     +           }
>>     +       }]
>>     +   } else {
>>     +       # If exceptions aren't supported, then they're not enabled.
>>     +       return 0
>>     +   }
>>     +    }]
>>     +}
>>
>>      proc check_effective_target_tiny {} {
>>          return [check_cached_effective_target tiny {
>>
>> ..., and it even already has one usage in libstdc++, per your
>> commit 4c27c6584d0c15926f57ac40f931e238cf0b3110
>> "libstdc++: Make testsuite usable with -fno-exceptions":
>>
>>     --- libstdc++-v3/testsuite/23_containers/vector/bool/72847.cc
>>     +++ libstdc++-v3/testsuite/23_containers/vector/bool/72847.cc
>>     @@ -15,7 +15,7 @@
>>      // with this library; see the file COPYING3.  If not see
>>      // <http://www.gnu.org/licenses/>.
>>
>>     -// { dg-skip-if "" { *-*-* } { "-fno-exceptions" } }
>>     +// { dg-require-effective-target exceptions_enabled }
>>
>>      #include <vector>
>>      #include <ext/throw_allocator.h>
>>
>> ;-)
>>
>>
> Ha! I forgot all about that.
>
> I'll change the rethrow_if_nested-term.cc test to the the effective target
> instead of dg-skip-if.
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Support 'UNSUPPORTED: [...]: exception handling disabled' for libstdc++ testing (was: Support in the GCC(/C++) test suites for '-fno-exceptions')
  2023-06-07  9:08       ` Thomas Schwinge
@ 2023-06-07 11:51         ` Jonathan Wakely
  2023-06-07 15:56           ` Jonathan Wakely
  0 siblings, 1 reply; 14+ messages in thread
From: Jonathan Wakely @ 2023-06-07 11:51 UTC (permalink / raw)
  To: Thomas Schwinge; +Cc: gcc-patches, libstdc++, Jozef Lawrynowicz

[-- Attachment #1: Type: text/plain, Size: 8282 bytes --]

On Wed, 7 Jun 2023 at 10:08, Thomas Schwinge <thomas@codesourcery.com>
wrote:

> Hi!
>
> On 2023-06-07T09:12:31+0100, Jonathan Wakely <jwakely@redhat.com> wrote:
> > On Wed, 7 Jun 2023 at 08:13, Thomas Schwinge wrote:
> >> On 2023-06-06T20:31:21+0100, Jonathan Wakely <jwakely@redhat.com>
> wrote:
> >> > On Tue, 6 Jun 2023 at 20:14, Thomas Schwinge <thomas@codesourcery.com
> >
> >> > wrote:
> >> >> This issue comes up in context of me working on C++ support for GCN
> and
> >> >> nvptx target.  Those targets shall default to '-fno-exceptions' --
> or,
> >> >> "in other words", '-fexceptions' is not supported.  (Details omitted
> >> >> here.)
> >> >>
> >> >> It did seem clear to me that with such a configuration it'll be hard
> to
> >> >> get clean test results.  Then I found code in
> >> >> 'gcc/testsuite/lib/gcc-dg.exp:gcc-dg-prune':
> >> >>
> >> >>     # If exceptions are disabled, mark tests expecting exceptions to
> be
> >> >> enabled
> >> >>     # as unsupported.
> >> >>     if { ![check_effective_target_exceptions_enabled] } {
> >> >>         if [regexp "(^|\n)\[^\n\]*: error: exception handling
> disabled"
> >> >> $text] {
> >> >>             return "::unsupported::exception handling disabled"
> >> >>         }
> >> >>
> >> >> ..., which, in a way, sounds as if the test suite generally is meant
> to
> >> >> produce useful results for '-fno-exceptions', nice surprise!
> >> >>
> >> >> Running x86_64-pc-linux-gnu (not yet GCN, nvptx) 'make check' with:
> >> >>
> >> >>     RUNTESTFLAGS='--target_board=unix/-fno-exceptions\{,-m32\}'
> >> >>
> >> >> ..., I find that indeed this does work for a lot of test cases,
> where we
> >> >> then get (random example):
> >> >>
> >> >>      PASS: g++.dg/coroutines/pr99710.C  (test for errors, line 23)
> >> >>     -PASS: g++.dg/coroutines/pr99710.C (test for excess errors)
> >> >>     +UNSUPPORTED: g++.dg/coroutines/pr99710.C: exception handling
> >> disabled
> >> >>
> >> >> ..., due to:
> >> >>
> >> >>      [...]/g++.dg/coroutines/pr99710.C: In function 'task my_coro()':
> >> >>     +[...]/g++.dg/coroutines/pr99710.C:18:10: error: exception
> handling
> >> >> disabled, use '-fexceptions' to enable
> >> >>      [...]/g++.dg/coroutines/pr99710.C:23:7: error: await expressions
> >> are
> >> >> not permitted in handlers
> >> >>      compiler exited with status 1
> >> >>
> >> >> But, we're nowhere near clean test results: PASS -> FAIL as well as
> >> >> XFAIL -> XPASS regressions, due to 'error: exception handling
> disabled'
> >> >> precluding other diagnostics seems to be one major issue.
> >> >>
> >> >> Is there interest in me producing the obvious (?) changes to those
> test
> >> >> cases, such that compiler g++ as well as target library libstdc++
> test
> >> >> results are reasonably clean?  (If you think that's all "wasted
> effort",
> >> >> then I suppose I'll just locally ignore any FAILs/XPASSes/UNRESOLVEDs
> >> >> that appear in combination with
> >> >> 'UNSUPPORTED: [...]: exception handling disabled'.)
> >> >
> >> > I would welcome that for libstdc++.
> >>
> >> Assuming no issues found in testing, OK to push the attached
> >> "Support 'UNSUPPORTED: [...]: exception handling disabled' for libstdc++
> >> testing"?
> >> (Thanks, Jozef!)
> >
> > Yes please.
>
> Pushed commit r14-1604-g5faaabef3819434d13fcbf749bd07bfc98ca7c3c
> "Support 'UNSUPPORTED: [...]: exception handling disabled' for libstdc++
> testing"
> to master branch, as posted.
>
> For one-week-old GCC commit 2720bbd597f56742a17119dfe80edc2ba86af255,
> x86_64-pc-linux-gnu, I see no changes without '-fno-exceptions' (as
> expected), and otherwise:
>
>                     === libstdc++ Summary for
> [-unix-]{+unix/-fno-exceptions+} ===
>
>     # of expected passes            [-15044-]{+12877+}
>     # of unexpected failures        [-5-]{+10+}
>     # of expected failures          [-106-]{+77+}
>     {+# of unresolved testcases     6+}
>     # of unsupported tests          [-747-]{+1846+}
>
> As expected, there's a good number of (random example):
>
>     -PASS: 18_support/105387.cc (test for excess errors)
>     -PASS: 18_support/105387.cc execution test
>     +UNSUPPORTED: 18_support/105387.cc: exception handling disabled
>
> ..., plus the following:
>
>     [-PASS:-]{+FAIL:+} 23_containers/vector/capacity/constexpr.cc (test
> for excess errors)
>
>
> [...]/libstdc++-v3/testsuite/23_containers/vector/capacity/constexpr.cc:101:
> error: non-constant condition for static assertion
>     In file included from
> [...]/libstdc++-v3/testsuite/23_containers/vector/capacity/constexpr.cc:6:
>
> [...]/libstdc++-v3/testsuite/23_containers/vector/capacity/constexpr.cc:101:
>  in 'constexpr' expansion of 'test_shrink_to_fit()'
>     [...]/libstdc++-v3/testsuite/util/testsuite_hooks.h:56: error:
> '__builtin_fprintf(stderr, ((const char*)"%s:%d: %s: Assertion \'%s\'
> failed.\012"), ((const
> char*)"[...]/libstdc++-v3/testsuite/23_containers/vector/capacity/constexpr.cc"),
> 92, ((const char*)"constexpr bool test_shrink_to_fit()"), ((const
> char*)"v.capacity() == 0"))' is not a constant expression
>     [...]/libstdc++-v3/testsuite/util/testsuite_hooks.h:66: note: in
> expansion of macro '_VERIFY_PRINT'
>
> [...]/libstdc++-v3/testsuite/23_containers/vector/capacity/constexpr.cc:92:
> note: in expansion of macro 'VERIFY'
>     compiler exited with status 1
>
> ..., and:
>
>     PASS: 23_containers/vector/capacity/shrink_to_fit.cc (test for excess
> errors)
>     [-PASS:-]{+FAIL:+} 23_containers/vector/capacity/shrink_to_fit.cc
> execution test
>
>
> [...]/libstdc++-v3/testsuite/23_containers/vector/capacity/shrink_to_fit.cc:33:
> void test01(): Assertion 'v.size() == v.capacity()' failed.
>
> ..., and:
>
>     PASS: 27_io/basic_ostream/inserters_arithmetic/pod/23875.cc (test for
> excess errors)
>     [-PASS:-]{+FAIL:+}
> 27_io/basic_ostream/inserters_arithmetic/pod/23875.cc execution test
>
>     terminate called after throwing an instance of 'std::bad_cast'
>       what():  std::bad_cast
>
> ..., and:
>
>     [-PASS:-]{+FAIL:+} ext/bitmap_allocator/check_allocate_max_size.cc
> (test for excess errors)
>     [-PASS:-]{+UNRESOLVED:+}
> ext/bitmap_allocator/check_allocate_max_size.cc [-execution
> test-]{+compilation failed to produce executable+}
>
>
> [...]/libstdc++-v3/testsuite/ext/bitmap_allocator/check_allocate_max_size.cc:
> In function 'int main()':
>
> [...]/libstdc++-v3/testsuite/ext/bitmap_allocator/check_allocate_max_size.cc:29:
> error: 'check_allocate_max_size' is not a member of '__gnu_test'
>
> [...]/libstdc++-v3/testsuite/ext/bitmap_allocator/check_allocate_max_size.cc:29:
> error: expected primary-expression before '>' token
>
> [...]/libstdc++-v3/testsuite/ext/bitmap_allocator/check_allocate_max_size.cc:29:
> error: expected primary-expression before ')' token
>
> ..., and similarly:
>
>     [-PASS:-]{+FAIL:+} ext/malloc_allocator/check_allocate_max_size.cc
> (test for excess errors)
>     [-PASS:-]{+UNRESOLVED:+}
> ext/malloc_allocator/check_allocate_max_size.cc [-execution
> test-]{+compilation failed to produce executable+}
>
>     [-PASS:-]{+FAIL:+} ext/mt_allocator/check_allocate_max_size.cc (test
> for excess errors)
>     [-PASS:-]{+UNRESOLVED:+} ext/mt_allocator/check_allocate_max_size.cc
> [-execution test-]{+compilation failed to produce executable+}
>
>     [-PASS:-]{+FAIL:+} ext/new_allocator/check_allocate_max_size.cc (test
> for excess errors)
>     [-PASS:-]{+UNRESOLVED:+} ext/new_allocator/check_allocate_max_size.cc
> [-execution test-]{+compilation failed to produce executable+}
>
>     [-PASS:-]{+FAIL:+} ext/pool_allocator/check_allocate_max_size.cc (test
> for excess errors)
>     [-PASS:-]{+UNRESOLVED:+} ext/pool_allocator/check_allocate_max_size.cc
> [-execution test-]{+compilation failed to produce executable+}
>
>     [-PASS:-]{+FAIL:+} ext/throw_allocator/check_allocate_max_size.cc
> (test for excess errors)
>     [-PASS:-]{+UNRESOLVED:+}
> ext/throw_allocator/check_allocate_max_size.cc [-execution
> test-]{+compilation failed to produce executable+}
>
> That's all!  :-)
>
> Given my limited C++ language and libstdc++ implementation skills, it's
> probably more effective if you address these?  But I'll of course give it
> a try if you'd like me to.
>

Yes, I'll fix those, thanks for the heads up.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Support 'UNSUPPORTED: [...]: exception handling disabled' for libstdc++ testing (was: Support in the GCC(/C++) test suites for '-fno-exceptions')
  2023-06-07 11:51         ` Jonathan Wakely
@ 2023-06-07 15:56           ` Jonathan Wakely
  0 siblings, 0 replies; 14+ messages in thread
From: Jonathan Wakely @ 2023-06-07 15:56 UTC (permalink / raw)
  To: Thomas Schwinge; +Cc: gcc-patches, libstdc++, Jozef Lawrynowicz

[-- Attachment #1: Type: text/plain, Size: 8711 bytes --]

On Wed, 7 Jun 2023 at 12:51, Jonathan Wakely <jwakely@redhat.com> wrote:

>
>
> On Wed, 7 Jun 2023 at 10:08, Thomas Schwinge <thomas@codesourcery.com>
> wrote:
>
>> Hi!
>>
>> On 2023-06-07T09:12:31+0100, Jonathan Wakely <jwakely@redhat.com> wrote:
>> > On Wed, 7 Jun 2023 at 08:13, Thomas Schwinge wrote:
>> >> On 2023-06-06T20:31:21+0100, Jonathan Wakely <jwakely@redhat.com>
>> wrote:
>> >> > On Tue, 6 Jun 2023 at 20:14, Thomas Schwinge <
>> thomas@codesourcery.com>
>> >> > wrote:
>> >> >> This issue comes up in context of me working on C++ support for GCN
>> and
>> >> >> nvptx target.  Those targets shall default to '-fno-exceptions' --
>> or,
>> >> >> "in other words", '-fexceptions' is not supported.  (Details omitted
>> >> >> here.)
>> >> >>
>> >> >> It did seem clear to me that with such a configuration it'll be
>> hard to
>> >> >> get clean test results.  Then I found code in
>> >> >> 'gcc/testsuite/lib/gcc-dg.exp:gcc-dg-prune':
>> >> >>
>> >> >>     # If exceptions are disabled, mark tests expecting exceptions
>> to be
>> >> >> enabled
>> >> >>     # as unsupported.
>> >> >>     if { ![check_effective_target_exceptions_enabled] } {
>> >> >>         if [regexp "(^|\n)\[^\n\]*: error: exception handling
>> disabled"
>> >> >> $text] {
>> >> >>             return "::unsupported::exception handling disabled"
>> >> >>         }
>> >> >>
>> >> >> ..., which, in a way, sounds as if the test suite generally is
>> meant to
>> >> >> produce useful results for '-fno-exceptions', nice surprise!
>> >> >>
>> >> >> Running x86_64-pc-linux-gnu (not yet GCN, nvptx) 'make check' with:
>> >> >>
>> >> >>     RUNTESTFLAGS='--target_board=unix/-fno-exceptions\{,-m32\}'
>> >> >>
>> >> >> ..., I find that indeed this does work for a lot of test cases,
>> where we
>> >> >> then get (random example):
>> >> >>
>> >> >>      PASS: g++.dg/coroutines/pr99710.C  (test for errors, line 23)
>> >> >>     -PASS: g++.dg/coroutines/pr99710.C (test for excess errors)
>> >> >>     +UNSUPPORTED: g++.dg/coroutines/pr99710.C: exception handling
>> >> disabled
>> >> >>
>> >> >> ..., due to:
>> >> >>
>> >> >>      [...]/g++.dg/coroutines/pr99710.C: In function 'task
>> my_coro()':
>> >> >>     +[...]/g++.dg/coroutines/pr99710.C:18:10: error: exception
>> handling
>> >> >> disabled, use '-fexceptions' to enable
>> >> >>      [...]/g++.dg/coroutines/pr99710.C:23:7: error: await
>> expressions
>> >> are
>> >> >> not permitted in handlers
>> >> >>      compiler exited with status 1
>> >> >>
>> >> >> But, we're nowhere near clean test results: PASS -> FAIL as well as
>> >> >> XFAIL -> XPASS regressions, due to 'error: exception handling
>> disabled'
>> >> >> precluding other diagnostics seems to be one major issue.
>> >> >>
>> >> >> Is there interest in me producing the obvious (?) changes to those
>> test
>> >> >> cases, such that compiler g++ as well as target library libstdc++
>> test
>> >> >> results are reasonably clean?  (If you think that's all "wasted
>> effort",
>> >> >> then I suppose I'll just locally ignore any
>> FAILs/XPASSes/UNRESOLVEDs
>> >> >> that appear in combination with
>> >> >> 'UNSUPPORTED: [...]: exception handling disabled'.)
>> >> >
>> >> > I would welcome that for libstdc++.
>> >>
>> >> Assuming no issues found in testing, OK to push the attached
>> >> "Support 'UNSUPPORTED: [...]: exception handling disabled' for
>> libstdc++
>> >> testing"?
>> >> (Thanks, Jozef!)
>> >
>> > Yes please.
>>
>> Pushed commit r14-1604-g5faaabef3819434d13fcbf749bd07bfc98ca7c3c
>> "Support 'UNSUPPORTED: [...]: exception handling disabled' for libstdc++
>> testing"
>> to master branch, as posted.
>>
>> For one-week-old GCC commit 2720bbd597f56742a17119dfe80edc2ba86af255,
>> x86_64-pc-linux-gnu, I see no changes without '-fno-exceptions' (as
>> expected), and otherwise:
>>
>>                     === libstdc++ Summary for
>> [-unix-]{+unix/-fno-exceptions+} ===
>>
>>     # of expected passes            [-15044-]{+12877+}
>>     # of unexpected failures        [-5-]{+10+}
>>     # of expected failures          [-106-]{+77+}
>>     {+# of unresolved testcases     6+}
>>     # of unsupported tests          [-747-]{+1846+}
>>
>> As expected, there's a good number of (random example):
>>
>>     -PASS: 18_support/105387.cc (test for excess errors)
>>     -PASS: 18_support/105387.cc execution test
>>     +UNSUPPORTED: 18_support/105387.cc: exception handling disabled
>>
>> ..., plus the following:
>>
>>     [-PASS:-]{+FAIL:+} 23_containers/vector/capacity/constexpr.cc (test
>> for excess errors)
>>
>>
>> [...]/libstdc++-v3/testsuite/23_containers/vector/capacity/constexpr.cc:101:
>> error: non-constant condition for static assertion
>>     In file included from
>> [...]/libstdc++-v3/testsuite/23_containers/vector/capacity/constexpr.cc:6:
>>
>> [...]/libstdc++-v3/testsuite/23_containers/vector/capacity/constexpr.cc:101:
>>  in 'constexpr' expansion of 'test_shrink_to_fit()'
>>     [...]/libstdc++-v3/testsuite/util/testsuite_hooks.h:56: error:
>> '__builtin_fprintf(stderr, ((const char*)"%s:%d: %s: Assertion \'%s\'
>> failed.\012"), ((const
>> char*)"[...]/libstdc++-v3/testsuite/23_containers/vector/capacity/constexpr.cc"),
>> 92, ((const char*)"constexpr bool test_shrink_to_fit()"), ((const
>> char*)"v.capacity() == 0"))' is not a constant expression
>>     [...]/libstdc++-v3/testsuite/util/testsuite_hooks.h:66: note: in
>> expansion of macro '_VERIFY_PRINT'
>>
>> [...]/libstdc++-v3/testsuite/23_containers/vector/capacity/constexpr.cc:92:
>> note: in expansion of macro 'VERIFY'
>>     compiler exited with status 1
>>
>> ..., and:
>>
>>     PASS: 23_containers/vector/capacity/shrink_to_fit.cc (test for excess
>> errors)
>>     [-PASS:-]{+FAIL:+} 23_containers/vector/capacity/shrink_to_fit.cc
>> execution test
>>
>>
>> [...]/libstdc++-v3/testsuite/23_containers/vector/capacity/shrink_to_fit.cc:33:
>> void test01(): Assertion 'v.size() == v.capacity()' failed.
>>
>> ..., and:
>>
>>     PASS: 27_io/basic_ostream/inserters_arithmetic/pod/23875.cc (test for
>> excess errors)
>>     [-PASS:-]{+FAIL:+}
>> 27_io/basic_ostream/inserters_arithmetic/pod/23875.cc execution test
>>
>>     terminate called after throwing an instance of 'std::bad_cast'
>>       what():  std::bad_cast
>>
>> ..., and:
>>
>>     [-PASS:-]{+FAIL:+} ext/bitmap_allocator/check_allocate_max_size.cc
>> (test for excess errors)
>>     [-PASS:-]{+UNRESOLVED:+}
>> ext/bitmap_allocator/check_allocate_max_size.cc [-execution
>> test-]{+compilation failed to produce executable+}
>>
>>
>> [...]/libstdc++-v3/testsuite/ext/bitmap_allocator/check_allocate_max_size.cc:
>> In function 'int main()':
>>
>> [...]/libstdc++-v3/testsuite/ext/bitmap_allocator/check_allocate_max_size.cc:29:
>> error: 'check_allocate_max_size' is not a member of '__gnu_test'
>>
>> [...]/libstdc++-v3/testsuite/ext/bitmap_allocator/check_allocate_max_size.cc:29:
>> error: expected primary-expression before '>' token
>>
>> [...]/libstdc++-v3/testsuite/ext/bitmap_allocator/check_allocate_max_size.cc:29:
>> error: expected primary-expression before ')' token
>>
>> ..., and similarly:
>>
>>     [-PASS:-]{+FAIL:+} ext/malloc_allocator/check_allocate_max_size.cc
>> (test for excess errors)
>>     [-PASS:-]{+UNRESOLVED:+}
>> ext/malloc_allocator/check_allocate_max_size.cc [-execution
>> test-]{+compilation failed to produce executable+}
>>
>>     [-PASS:-]{+FAIL:+} ext/mt_allocator/check_allocate_max_size.cc (test
>> for excess errors)
>>     [-PASS:-]{+UNRESOLVED:+} ext/mt_allocator/check_allocate_max_size.cc
>> [-execution test-]{+compilation failed to produce executable+}
>>
>>     [-PASS:-]{+FAIL:+} ext/new_allocator/check_allocate_max_size.cc (test
>> for excess errors)
>>     [-PASS:-]{+UNRESOLVED:+} ext/new_allocator/check_allocate_max_size.cc
>> [-execution test-]{+compilation failed to produce executable+}
>>
>>     [-PASS:-]{+FAIL:+} ext/pool_allocator/check_allocate_max_size.cc
>> (test for excess errors)
>>     [-PASS:-]{+UNRESOLVED:+}
>> ext/pool_allocator/check_allocate_max_size.cc [-execution
>> test-]{+compilation failed to produce executable+}
>>
>>     [-PASS:-]{+FAIL:+} ext/throw_allocator/check_allocate_max_size.cc
>> (test for excess errors)
>>     [-PASS:-]{+UNRESOLVED:+}
>> ext/throw_allocator/check_allocate_max_size.cc [-execution
>> test-]{+compilation failed to produce executable+}
>>
>> That's all!  :-)
>>
>> Given my limited C++ language and libstdc++ implementation skills, it's
>> probably more effective if you address these?  But I'll of course give it
>> a try if you'd like me to.
>>
>
> Yes, I'll fix those, thanks for the heads up.
>
>
Done at r14-1612-gfa8b4468e0d124

I didn't fix 27_io/basic_ostream/inserters_arithmetic/pod/23875.cc yet
though.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Skip a number of C++ test cases for '-fno-exceptions' testing (was: Support in the GCC(/C++) test suites for '-fno-exceptions')
       [not found] ` <CACb0b4kDiwp5nEY952rbLAKy7_+iJey71z3WNMUxahTaLQt6vA@mail.gmail.com>
  2023-06-07  7:13   ` Support 'UNSUPPORTED: [...]: exception handling disabled' for libstdc++ testing (was: Support in the GCC(/C++) test suites for '-fno-exceptions') Thomas Schwinge
@ 2023-06-15 15:15   ` Thomas Schwinge
  2023-06-15 15:47     ` Skip a number of C++ "split files" test cases for '-fno-exceptions' testing (was: Skip a number of C++ test cases for '-fno-exceptions' testing (was: Support in the GCC(/C++) test suites for '-fno-exceptions')) Thomas Schwinge
                       ` (2 more replies)
  1 sibling, 3 replies; 14+ messages in thread
From: Thomas Schwinge @ 2023-06-15 15:15 UTC (permalink / raw)
  To: gcc-patches, Jason Merrill, Nathan Sidwell; +Cc: libstdc++, Jonathan Wakely

[-- Attachment #1: Type: text/plain, Size: 5214 bytes --]

Hi!

On 2023-06-06T20:31:21+0100, Jonathan Wakely <jwakely@redhat.com> wrote:
> On Tue, 6 Jun 2023 at 20:14, Thomas Schwinge <thomas@codesourcery.com> wrote:
>> This issue comes up in context of me working on C++ support for GCN and
>> nvptx target.  Those targets shall default to '-fno-exceptions' -- or,
>> "in other words", '-fexceptions' is not supported.  (Details omitted
>> here.)
>>
>> It did seem clear to me that with such a configuration it'll be hard to
>> get clean test results.  Then I found code in
>> 'gcc/testsuite/lib/gcc-dg.exp:gcc-dg-prune':
>>
>>     # If exceptions are disabled, mark tests expecting exceptions to be enabled
>>     # as unsupported.
>>     if { ![check_effective_target_exceptions_enabled] } {
>>         if [regexp "(^|\n)\[^\n\]*: error: exception handling disabled" $text] {
>>             return "::unsupported::exception handling disabled"
>>         }
>>
>> ..., which, in a way, sounds as if the test suite generally is meant to
>> produce useful results for '-fno-exceptions', nice surprise!
>>
>> Running x86_64-pc-linux-gnu (not yet GCN, nvptx) 'make check' with:
>>
>>     RUNTESTFLAGS='--target_board=unix/-fno-exceptions\{,-m32\}'
>>
>> ..., I find that indeed this does work for a lot of test cases, where we
>> then get (random example):
>>
>>      PASS: g++.dg/coroutines/pr99710.C  (test for errors, line 23)
>>     -PASS: g++.dg/coroutines/pr99710.C (test for excess errors)
>>     +UNSUPPORTED: g++.dg/coroutines/pr99710.C: exception handling disabled
>>
>> ..., due to:
>>
>>      [...]/g++.dg/coroutines/pr99710.C: In function 'task my_coro()':
>>     +[...]/g++.dg/coroutines/pr99710.C:18:10: error: exception handling
>> disabled, use '-fexceptions' to enable
>>      [...]/g++.dg/coroutines/pr99710.C:23:7: error: await expressions are
>> not permitted in handlers
>>      compiler exited with status 1
>>
>> But, we're nowhere near clean test results: PASS -> FAIL as well as
>> XFAIL -> XPASS regressions, due to 'error: exception handling disabled'
>> precluding other diagnostics seems to be one major issue.
>>
>> Is there interest in me producing the obvious (?) changes to those test
>> cases, such that compiler g++ as well as target library libstdc++ test
>> results are reasonably clean?  (If you think that's all "wasted effort",
>> then I suppose I'll just locally ignore any FAILs/XPASSes/UNRESOLVEDs
>> that appear in combination with
>> 'UNSUPPORTED: [...]: exception handling disabled'.)
>
> I would welcome that for libstdc++. I do sometimes run the libstdc++ tests
> with "unusual" options, like -fno-exceptions and -fno-rtti (e.g. today I've
> been fixing FAILs that only happen with -fexcess-precision=standard). I
> just manually ignore the tests that fail for -fno-exceptions, but it would
> be great if they were automatically skipped as UNSUPPORTED.

Per your and my changes a few days ago, we've already got libstdc++
covered, with the sole exception of:

    PASS: 27_io/basic_ostream/inserters_arithmetic/pod/23875.cc (test for excess errors)
    [-PASS:-]{+FAIL:+} 27_io/basic_ostream/inserters_arithmetic/pod/23875.cc execution test

    terminate called after throwing an instance of 'std::bad_cast'
      what():  std::bad_cast

(Low priority for me.)

Not having heard anything contrary regarding the compiler side of things,
I've now been working on that, see below.

> We already have a handful of tests that use #if __cpp_exceptions to make
> those parts conditional on exception support.

Yes, that's an option not for all but certainly for some test cases.
(I'm not looking into that now -- but this may in fact be a good
beginner-level task, will add to <https://gcc.gnu.org/wiki/EasyHacks>).

>> Otherwise, a number of test cases need DejaGnu directives
>> conditionalized on 'target exceptions_enabled'.

Before I get to such things, even simpler: OK to push the attached
"Skip a number of C++ test cases for '-fno-exceptions' testing"?


>> (Or,
>> 'error: exception handling disabled' made a "really late" diagnostic, so
>> that it doesn't preclude other diagnostics?  I'll have a look.  Well,
>> maybe something like: in fact do not default to '-fno-exceptions', but
>> instead emit 'error: exception handling disabled' only if in a "really
>> late" pass we run into exceptions-related constructs that we cannot
>> support.  That'd also avoid PASS -> UNSUPPORTED "regressions" when
>> exception handling in fact gets optimized away, for example.  I like that
>> idea, conceptually -- but is it feasible to implement..?)
>
> IMHO just [...] using [an effective target keyword] in test
> selectors seems simpler, and doesn't require changes to the compiler, just
> the tests.

I still like the idea, but yes, I've mentally put it on file "for later"
(ha, ha, ha...) -- it doesn't seem obvious to implement.


Grüße
 Thomas


-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Skip-a-number-of-C-test-cases-for-fno-exceptions-tes.patch --]
[-- Type: text/x-diff, Size: 27888 bytes --]

From fb7847774109c47708bc0fe26270d89a0db8ae0b Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Wed, 7 Jun 2023 14:14:44 +0200
Subject: [PATCH] Skip a number of C++ test cases for '-fno-exceptions' testing

Running 'make check' with: 'RUNTESTFLAGS=--target_board=unix/-fno-exceptions',
'error: exception handling disabled' is triggered for C++ 'throw' etc. usage,
and per 'gcc/testsuite/lib/gcc-dg.exp:gcc-dg-prune':

    # If exceptions are disabled, mark tests expecting exceptions to be enabled
    # as unsupported.
    if { ![check_effective_target_exceptions_enabled] } {
	if [regexp "(^|\n)\[^\n\]*: error: exception handling disabled" $text] {
	    return "::unsupported::exception handling disabled"
	}

..., which generally means:

    -PASS: [...] (test for excess errors)
    +UNSUPPORTED: [...]: exception handling disabled

However, if there are additional 'dg-error' etc. directives, these may regress
PASS -> FAIL (or similar) -- if their associated diagnostics are precluded by
'error: exception handling disabled'.  For example:

    PASS: g++.dg/cpp2a/explicit1.C    (test for errors, line 43)
    PASS: g++.dg/cpp2a/explicit1.C    (test for errors, line 47)
    [-PASS:-]{+FAIL:+} g++.dg/cpp2a/explicit1.C    (test for errors, line 50)
    [-PASS:-]{+FAIL:+} g++.dg/cpp2a/explicit1.C    (test for errors, line 51)
    PASS: g++.dg/cpp2a/explicit1.C    (test for errors, line 52)
    PASS: g++.dg/cpp2a/explicit1.C    (test for errors, line 53)
    PASS: g++.dg/cpp2a/explicit1.C    (test for errors, line 59)
    [-PASS:-]{+UNSUPPORTED:+} g++.dg/cpp2a/explicit1.C  [-(test for excess errors)-]{+: exception handling disabled+}

Specify 'dg-require-effective-target exceptions_enabled' for those test cases.

	gcc/testsuite/
	* g++.dg/coroutines/pr95616-0.C: Specify
	'dg-require-effective-target exceptions_enabled'.
	* g++.dg/coroutines/pr95616-1.C: Likewise.
	* g++.dg/coroutines/pr95616-2.C: Likewise.
	* g++.dg/coroutines/pr95616-3.C: Likewise.
	* g++.dg/coroutines/pr95616-4.C: Likewise.
	* g++.dg/coroutines/pr95616-5.C: Likewise.
	* g++.dg/coroutines/pr95616-6.C: Likewise.
	* g++.dg/cpp0x/catch1.C: Likewise.
	* g++.dg/cpp0x/constexpr-throw.C: Likewise.
	* g++.dg/cpp1y/constexpr-89785-2.C: Likewise.
	* g++.dg/cpp1y/constexpr-throw.C: Likewise.
	* g++.dg/cpp1y/pr79393-3.C: Likewise.
	* g++.dg/cpp2a/consteval-memfn1.C: Likewise.
	* g++.dg/cpp2a/consteval11.C: Likewise.
	* g++.dg/cpp2a/consteval9.C: Likewise.
	* g++.dg/cpp2a/explicit1.C: Likewise.
	* g++.dg/cpp2a/explicit2.C: Likewise.
	* g++.dg/cpp2a/explicit5.C: Likewise.
	* g++.dg/eh/builtin10.C: Likewise.
	* g++.dg/eh/builtin11.C: Likewise.
	* g++.dg/eh/builtin6.C: Likewise.
	* g++.dg/eh/builtin7.C: Likewise.
	* g++.dg/eh/builtin9.C: Likewise.
	* g++.dg/eh/dtor4.C: Likewise.
	* g++.dg/eh/pr42859.C: Likewise.
	* g++.dg/ext/stmtexpr25.C: Likewise.
	* g++.dg/ext/vla4.C: Likewise.
	* g++.dg/init/placement4.C: Likewise.
	* g++.dg/other/error32.C: Likewise.
	* g++.dg/parse/crash55.C: Likewise.
	* g++.dg/parse/pr31952-2.C: Likewise.
	* g++.dg/parse/pr31952-3.C: Likewise.
	* g++.dg/tm/noexcept-7.C: Likewise.
	* g++.dg/torture/pr43257.C: Likewise.
	* g++.dg/torture/pr56694.C: Likewise.
	* g++.dg/torture/pr81659.C: Likewise.
	* g++.dg/warn/Wcatch-value-1.C: Likewise.
	* g++.dg/warn/Wcatch-value-2.C: Likewise.
	* g++.dg/warn/Wcatch-value-3.C: Likewise.
	* g++.dg/warn/Wcatch-value-3b.C: Likewise.
	* g++.dg/warn/Wexceptions1.C: Likewise.
	* g++.dg/warn/Wexceptions3.C: Likewise.
	* g++.dg/warn/Winfinite-recursion-3.C: Likewise.
	* g++.dg/warn/Wreturn-6.C: Likewise.
	* g++.dg/warn/Wstringop-truncation-2.C: Likewise.
	* g++.dg/warn/Wterminate1.C: Likewise.
	* g++.old-deja/g++.eh/catch1.C: Likewise.
	* g++.old-deja/g++.eh/catch10.C: Likewise.
	* g++.old-deja/g++.eh/cond1.C: Likewise.
	* g++.old-deja/g++.eh/ctor1.C: Likewise.
	* g++.old-deja/g++.eh/throw2.C: Likewise.
	* g++.old-deja/g++.other/cond5.C: Likewise.
---
 gcc/testsuite/g++.dg/coroutines/pr95616-0.C        | 1 +
 gcc/testsuite/g++.dg/coroutines/pr95616-1.C        | 1 +
 gcc/testsuite/g++.dg/coroutines/pr95616-2.C        | 1 +
 gcc/testsuite/g++.dg/coroutines/pr95616-3.C        | 1 +
 gcc/testsuite/g++.dg/coroutines/pr95616-4.C        | 1 +
 gcc/testsuite/g++.dg/coroutines/pr95616-5.C        | 1 +
 gcc/testsuite/g++.dg/coroutines/pr95616-6.C        | 1 +
 gcc/testsuite/g++.dg/cpp0x/catch1.C                | 1 +
 gcc/testsuite/g++.dg/cpp0x/constexpr-throw.C       | 1 +
 gcc/testsuite/g++.dg/cpp1y/constexpr-89785-2.C     | 1 +
 gcc/testsuite/g++.dg/cpp1y/constexpr-throw.C       | 1 +
 gcc/testsuite/g++.dg/cpp1y/pr79393-3.C             | 1 +
 gcc/testsuite/g++.dg/cpp2a/consteval-memfn1.C      | 1 +
 gcc/testsuite/g++.dg/cpp2a/consteval11.C           | 1 +
 gcc/testsuite/g++.dg/cpp2a/consteval9.C            | 1 +
 gcc/testsuite/g++.dg/cpp2a/explicit1.C             | 1 +
 gcc/testsuite/g++.dg/cpp2a/explicit2.C             | 1 +
 gcc/testsuite/g++.dg/cpp2a/explicit5.C             | 1 +
 gcc/testsuite/g++.dg/eh/builtin10.C                | 1 +
 gcc/testsuite/g++.dg/eh/builtin11.C                | 1 +
 gcc/testsuite/g++.dg/eh/builtin6.C                 | 1 +
 gcc/testsuite/g++.dg/eh/builtin7.C                 | 1 +
 gcc/testsuite/g++.dg/eh/builtin9.C                 | 1 +
 gcc/testsuite/g++.dg/eh/dtor4.C                    | 2 ++
 gcc/testsuite/g++.dg/eh/pr42859.C                  | 1 +
 gcc/testsuite/g++.dg/ext/stmtexpr25.C              | 1 +
 gcc/testsuite/g++.dg/ext/vla4.C                    | 1 +
 gcc/testsuite/g++.dg/init/placement4.C             | 2 ++
 gcc/testsuite/g++.dg/other/error32.C               | 1 +
 gcc/testsuite/g++.dg/parse/crash55.C               | 2 ++
 gcc/testsuite/g++.dg/parse/pr31952-2.C             | 2 ++
 gcc/testsuite/g++.dg/parse/pr31952-3.C             | 2 ++
 gcc/testsuite/g++.dg/tm/noexcept-7.C               | 1 +
 gcc/testsuite/g++.dg/torture/pr43257.C             | 1 +
 gcc/testsuite/g++.dg/torture/pr56694.C             | 1 +
 gcc/testsuite/g++.dg/torture/pr81659.C             | 1 +
 gcc/testsuite/g++.dg/warn/Wcatch-value-1.C         | 1 +
 gcc/testsuite/g++.dg/warn/Wcatch-value-2.C         | 1 +
 gcc/testsuite/g++.dg/warn/Wcatch-value-3.C         | 1 +
 gcc/testsuite/g++.dg/warn/Wcatch-value-3b.C        | 1 +
 gcc/testsuite/g++.dg/warn/Wexceptions1.C           | 2 ++
 gcc/testsuite/g++.dg/warn/Wexceptions3.C           | 2 ++
 gcc/testsuite/g++.dg/warn/Winfinite-recursion-3.C  | 1 +
 gcc/testsuite/g++.dg/warn/Wreturn-6.C              | 2 ++
 gcc/testsuite/g++.dg/warn/Wstringop-truncation-2.C | 1 +
 gcc/testsuite/g++.dg/warn/Wterminate1.C            | 1 +
 gcc/testsuite/g++.old-deja/g++.eh/catch1.C         | 1 +
 gcc/testsuite/g++.old-deja/g++.eh/catch10.C        | 1 +
 gcc/testsuite/g++.old-deja/g++.eh/cond1.C          | 1 +
 gcc/testsuite/g++.old-deja/g++.eh/ctor1.C          | 2 ++
 gcc/testsuite/g++.old-deja/g++.eh/throw2.C         | 1 +
 gcc/testsuite/g++.old-deja/g++.other/cond5.C       | 1 +
 52 files changed, 61 insertions(+)

diff --git a/gcc/testsuite/g++.dg/coroutines/pr95616-0.C b/gcc/testsuite/g++.dg/coroutines/pr95616-0.C
index e500b6ea636..3d0cc59fbb8 100644
--- a/gcc/testsuite/g++.dg/coroutines/pr95616-0.C
+++ b/gcc/testsuite/g++.dg/coroutines/pr95616-0.C
@@ -1,3 +1,4 @@
+//  { dg-require-effective-target exceptions_enabled }
 //  { dg-additional-options "-fsyntax-only" }
 
 #if __has_include(<coroutine>)
diff --git a/gcc/testsuite/g++.dg/coroutines/pr95616-1.C b/gcc/testsuite/g++.dg/coroutines/pr95616-1.C
index c3989804e6b..2c7d7f2f6e8 100644
--- a/gcc/testsuite/g++.dg/coroutines/pr95616-1.C
+++ b/gcc/testsuite/g++.dg/coroutines/pr95616-1.C
@@ -1,3 +1,4 @@
+//  { dg-require-effective-target exceptions_enabled }
 //  { dg-additional-options "-fsyntax-only" }
 
 #if __has_include(<coroutine>)
diff --git a/gcc/testsuite/g++.dg/coroutines/pr95616-2.C b/gcc/testsuite/g++.dg/coroutines/pr95616-2.C
index 6ad251986ec..671a3f30a3a 100644
--- a/gcc/testsuite/g++.dg/coroutines/pr95616-2.C
+++ b/gcc/testsuite/g++.dg/coroutines/pr95616-2.C
@@ -1,3 +1,4 @@
+//  { dg-require-effective-target exceptions_enabled }
 //  { dg-additional-options "-fsyntax-only" }
 
 #if __has_include(<coroutine>)
diff --git a/gcc/testsuite/g++.dg/coroutines/pr95616-3.C b/gcc/testsuite/g++.dg/coroutines/pr95616-3.C
index 7da1f6a9658..e650d89e92a 100644
--- a/gcc/testsuite/g++.dg/coroutines/pr95616-3.C
+++ b/gcc/testsuite/g++.dg/coroutines/pr95616-3.C
@@ -1,3 +1,4 @@
+//  { dg-require-effective-target exceptions_enabled }
 //  { dg-additional-options "-fsyntax-only" }
 
 #if __has_include(<coroutine>)
diff --git a/gcc/testsuite/g++.dg/coroutines/pr95616-4.C b/gcc/testsuite/g++.dg/coroutines/pr95616-4.C
index ef6a160a5c4..b783a9d338c 100644
--- a/gcc/testsuite/g++.dg/coroutines/pr95616-4.C
+++ b/gcc/testsuite/g++.dg/coroutines/pr95616-4.C
@@ -1,3 +1,4 @@
+//  { dg-require-effective-target exceptions_enabled }
 //  { dg-additional-options "-fsyntax-only" }
 
 #if __has_include(<coroutine>)
diff --git a/gcc/testsuite/g++.dg/coroutines/pr95616-5.C b/gcc/testsuite/g++.dg/coroutines/pr95616-5.C
index 930c1a7e6a1..f7602bc593a 100644
--- a/gcc/testsuite/g++.dg/coroutines/pr95616-5.C
+++ b/gcc/testsuite/g++.dg/coroutines/pr95616-5.C
@@ -1,3 +1,4 @@
+//  { dg-require-effective-target exceptions_enabled }
 //  { dg-additional-options "-fsyntax-only" }
 
 #if __has_include(<coroutine>)
diff --git a/gcc/testsuite/g++.dg/coroutines/pr95616-6.C b/gcc/testsuite/g++.dg/coroutines/pr95616-6.C
index e7481711c5e..e535cc9a7d7 100644
--- a/gcc/testsuite/g++.dg/coroutines/pr95616-6.C
+++ b/gcc/testsuite/g++.dg/coroutines/pr95616-6.C
@@ -1,3 +1,4 @@
+//  { dg-require-effective-target exceptions_enabled }
 //  { dg-additional-options "-fsyntax-only" }
 
 #if __has_include(<coroutine>)
diff --git a/gcc/testsuite/g++.dg/cpp0x/catch1.C b/gcc/testsuite/g++.dg/cpp0x/catch1.C
index 81778ea7807..18ff3679a58 100644
--- a/gcc/testsuite/g++.dg/cpp0x/catch1.C
+++ b/gcc/testsuite/g++.dg/cpp0x/catch1.C
@@ -1,5 +1,6 @@
 // PR c++/53371
 // { dg-do compile { target c++11 } }
+// { dg-require-effective-target exceptions_enabled }
 
 struct Abs
 {
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-throw.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-throw.C
index 5666629acae..640f798a154 100644
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-throw.C
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-throw.C
@@ -1,4 +1,5 @@
 // { dg-do compile { target c++11 } }
+// { dg-require-effective-target exceptions_enabled }
 
 constexpr int may_throw(bool decide) {
 	return decide ? 42 : throw -1; // { dg-error "throw" }
diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-89785-2.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-89785-2.C
index 7afd9d24e98..c7fdf678aaf 100644
--- a/gcc/testsuite/g++.dg/cpp1y/constexpr-89785-2.C
+++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-89785-2.C
@@ -1,5 +1,6 @@
 // PR c++/89785
 // { dg-do compile { target c++14 } }
+// { dg-require-effective-target exceptions_enabled }
 
 constexpr int
 foo (int x)
diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-throw.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-throw.C
index 35928744686..305a87b9a78 100644
--- a/gcc/testsuite/g++.dg/cpp1y/constexpr-throw.C
+++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-throw.C
@@ -1,4 +1,5 @@
 // { dg-do compile { target c++14 } }
+// { dg-require-effective-target exceptions_enabled }
 
 constexpr void f1() {
   if (false)
diff --git a/gcc/testsuite/g++.dg/cpp1y/pr79393-3.C b/gcc/testsuite/g++.dg/cpp1y/pr79393-3.C
index 3c73cbbb659..8568d03856d 100644
--- a/gcc/testsuite/g++.dg/cpp1y/pr79393-3.C
+++ b/gcc/testsuite/g++.dg/cpp1y/pr79393-3.C
@@ -1,5 +1,6 @@
 // pr c++/79393
 // { dg-do compile { target c++14 } }
+// { dg-require-effective-target exceptions_enabled }
 
 struct A 
 {
diff --git a/gcc/testsuite/g++.dg/cpp2a/consteval-memfn1.C b/gcc/testsuite/g++.dg/cpp2a/consteval-memfn1.C
index 910e7a1ac1e..757ebac753c 100644
--- a/gcc/testsuite/g++.dg/cpp2a/consteval-memfn1.C
+++ b/gcc/testsuite/g++.dg/cpp2a/consteval-memfn1.C
@@ -1,5 +1,6 @@
 // PR c++/99895
 // { dg-do compile { target c++20 } }
+// { dg-require-effective-target exceptions_enabled }
 
 struct fixed_string {
   consteval int size(int n) const {
diff --git a/gcc/testsuite/g++.dg/cpp2a/consteval11.C b/gcc/testsuite/g++.dg/cpp2a/consteval11.C
index 2f68ec0f892..40694cef4ba 100644
--- a/gcc/testsuite/g++.dg/cpp2a/consteval11.C
+++ b/gcc/testsuite/g++.dg/cpp2a/consteval11.C
@@ -1,4 +1,5 @@
 // { dg-do compile }
+// { dg-require-effective-target exceptions_enabled }
 // { dg-options "-std=c++2a" }
 
 consteval int bar (int i) { if (i != 1) throw 1; return 0; }	// { dg-error "is not a constant expression" }
diff --git a/gcc/testsuite/g++.dg/cpp2a/consteval9.C b/gcc/testsuite/g++.dg/cpp2a/consteval9.C
index 489286a12d2..36ab3d7ee84 100644
--- a/gcc/testsuite/g++.dg/cpp2a/consteval9.C
+++ b/gcc/testsuite/g++.dg/cpp2a/consteval9.C
@@ -1,4 +1,5 @@
 // { dg-do compile }
+// { dg-require-effective-target exceptions_enabled }
 // { dg-options "-std=c++2a" }
 
 consteval int bar (int i) { if (i != 1) throw 1; return 0; }	// { dg-error "is not a constant expression" }
diff --git a/gcc/testsuite/g++.dg/cpp2a/explicit1.C b/gcc/testsuite/g++.dg/cpp2a/explicit1.C
index b39f90f3397..d7e1f3fb1db 100644
--- a/gcc/testsuite/g++.dg/cpp2a/explicit1.C
+++ b/gcc/testsuite/g++.dg/cpp2a/explicit1.C
@@ -1,5 +1,6 @@
 // P0892R2
 // { dg-do compile }
+// { dg-require-effective-target exceptions_enabled }
 // { dg-options "-std=c++2a" }
 
 constexpr int fn0 () { return 0; }
diff --git a/gcc/testsuite/g++.dg/cpp2a/explicit2.C b/gcc/testsuite/g++.dg/cpp2a/explicit2.C
index 7d1748c0f5e..d0f001af177 100644
--- a/gcc/testsuite/g++.dg/cpp2a/explicit2.C
+++ b/gcc/testsuite/g++.dg/cpp2a/explicit2.C
@@ -1,5 +1,6 @@
 // P0892R2
 // { dg-do compile }
+// { dg-require-effective-target exceptions_enabled }
 // { dg-options "-std=c++2a" }
 
 int foo() { return 42; }
diff --git a/gcc/testsuite/g++.dg/cpp2a/explicit5.C b/gcc/testsuite/g++.dg/cpp2a/explicit5.C
index 70a106f1fcb..ae4c7cab2ea 100644
--- a/gcc/testsuite/g++.dg/cpp2a/explicit5.C
+++ b/gcc/testsuite/g++.dg/cpp2a/explicit5.C
@@ -1,5 +1,6 @@
 // P0892R2
 // { dg-do compile }
+// { dg-require-effective-target exceptions_enabled }
 // { dg-options "-std=c++2a" }
 
 constexpr int fn0 () { return 0; }
diff --git a/gcc/testsuite/g++.dg/eh/builtin10.C b/gcc/testsuite/g++.dg/eh/builtin10.C
index 6c34f1f6d5c..f09291aebda 100644
--- a/gcc/testsuite/g++.dg/eh/builtin10.C
+++ b/gcc/testsuite/g++.dg/eh/builtin10.C
@@ -1,5 +1,6 @@
 // PR c++/88482
 // { dg-do compile }
+// { dg-require-effective-target exceptions_enabled }
 
 extern "C" void __cxa_throw (void *, void *, void (*) (void *));
 extern "C" float __cxa_get_exception_ptr (void *) throw ();	// { dg-message "previous declaration" }
diff --git a/gcc/testsuite/g++.dg/eh/builtin11.C b/gcc/testsuite/g++.dg/eh/builtin11.C
index abc8c1af535..04376d3c36a 100644
--- a/gcc/testsuite/g++.dg/eh/builtin11.C
+++ b/gcc/testsuite/g++.dg/eh/builtin11.C
@@ -1,5 +1,6 @@
 // PR c++/88482
 // { dg-do compile }
+// { dg-require-effective-target exceptions_enabled }
 
 extern "C" void __cxa_throw (float, void *, void (*) (void *));	// { dg-message "previous declaration" }
 extern "C" void *__cxa_get_exception_ptr (void *) throw ();
diff --git a/gcc/testsuite/g++.dg/eh/builtin6.C b/gcc/testsuite/g++.dg/eh/builtin6.C
index c05abdc8f51..3cc56510e0e 100644
--- a/gcc/testsuite/g++.dg/eh/builtin6.C
+++ b/gcc/testsuite/g++.dg/eh/builtin6.C
@@ -1,5 +1,6 @@
 // PR c++/88482
 // { dg-do compile }
+// { dg-require-effective-target exceptions_enabled }
 
 float __cxa_throw;		// { dg-message "previous declaration" }
 extern "C" void *__cxa_get_exception_ptr (void *);
diff --git a/gcc/testsuite/g++.dg/eh/builtin7.C b/gcc/testsuite/g++.dg/eh/builtin7.C
index 0ef279d09c1..5c79e2a2261 100644
--- a/gcc/testsuite/g++.dg/eh/builtin7.C
+++ b/gcc/testsuite/g++.dg/eh/builtin7.C
@@ -1,5 +1,6 @@
 // PR c++/88482
 // { dg-do compile }
+// { dg-require-effective-target exceptions_enabled }
 
 extern "C" void __cxa_throw (void *, void *, void (*) (void *));
 int __cxa_get_exception_ptr;		// { dg-message "previous declaration" }
diff --git a/gcc/testsuite/g++.dg/eh/builtin9.C b/gcc/testsuite/g++.dg/eh/builtin9.C
index 591a622630c..4e6ad073cbf 100644
--- a/gcc/testsuite/g++.dg/eh/builtin9.C
+++ b/gcc/testsuite/g++.dg/eh/builtin9.C
@@ -1,5 +1,6 @@
 // PR c++/88482
 // { dg-do compile }
+// { dg-require-effective-target exceptions_enabled }
 
 extern "C" int __cxa_throw (void *, void *, void (*) (void *));	// { dg-message "previous declaration" }
 extern "C" void *__cxa_get_exception_ptr (void *) throw ();
diff --git a/gcc/testsuite/g++.dg/eh/dtor4.C b/gcc/testsuite/g++.dg/eh/dtor4.C
index 6c0e804fe8a..0086121e45a 100644
--- a/gcc/testsuite/g++.dg/eh/dtor4.C
+++ b/gcc/testsuite/g++.dg/eh/dtor4.C
@@ -1,5 +1,7 @@
 // PR c++/109172
 
+// { dg-require-effective-target exceptions_enabled }
+
 class Demo
 {
   ~Demo();
diff --git a/gcc/testsuite/g++.dg/eh/pr42859.C b/gcc/testsuite/g++.dg/eh/pr42859.C
index 0de91409c83..8d3f429c628 100644
--- a/gcc/testsuite/g++.dg/eh/pr42859.C
+++ b/gcc/testsuite/g++.dg/eh/pr42859.C
@@ -1,4 +1,5 @@
 // { dg-do compile }
+// { dg-require-effective-target exceptions_enabled }
 
 void start (void);
 void
diff --git a/gcc/testsuite/g++.dg/ext/stmtexpr25.C b/gcc/testsuite/g++.dg/ext/stmtexpr25.C
index 79c40fc61c4..856f7d29e59 100644
--- a/gcc/testsuite/g++.dg/ext/stmtexpr25.C
+++ b/gcc/testsuite/g++.dg/ext/stmtexpr25.C
@@ -1,6 +1,7 @@
 // PR c++/81073
 // { dg-options "" }
 // { dg-do compile { target c++11 } }
+// { dg-require-effective-target exceptions_enabled }
 
 struct test { const int *addr; };
 
diff --git a/gcc/testsuite/g++.dg/ext/vla4.C b/gcc/testsuite/g++.dg/ext/vla4.C
index e96f2735f8a..c2339359c4f 100644
--- a/gcc/testsuite/g++.dg/ext/vla4.C
+++ b/gcc/testsuite/g++.dg/ext/vla4.C
@@ -1,4 +1,5 @@
 // PR c++/29318
+// { dg-require-effective-target exceptions_enabled }
 // { dg-options "" }
 
 #include <typeinfo>
diff --git a/gcc/testsuite/g++.dg/init/placement4.C b/gcc/testsuite/g++.dg/init/placement4.C
index 3cfe27d63e6..912fc1d03f8 100644
--- a/gcc/testsuite/g++.dg/init/placement4.C
+++ b/gcc/testsuite/g++.dg/init/placement4.C
@@ -1,5 +1,7 @@
 // PR c++/34158
 
+// { dg-require-effective-target exceptions_enabled }
+
 typedef __SIZE_TYPE__ size_t;
 extern "C" void* malloc (size_t);
 extern "C" void free (void *);
diff --git a/gcc/testsuite/g++.dg/other/error32.C b/gcc/testsuite/g++.dg/other/error32.C
index 56d3b7aec8b..19a5a00a2e9 100644
--- a/gcc/testsuite/g++.dg/other/error32.C
+++ b/gcc/testsuite/g++.dg/other/error32.C
@@ -1,4 +1,5 @@
 // PR c++/33492
+// { dg-require-effective-target exceptions_enabled }
 // { dg-options "" }
 
 void foo()
diff --git a/gcc/testsuite/g++.dg/parse/crash55.C b/gcc/testsuite/g++.dg/parse/crash55.C
index 2e88c476fc7..30f7a50f9fa 100644
--- a/gcc/testsuite/g++.dg/parse/crash55.C
+++ b/gcc/testsuite/g++.dg/parse/crash55.C
@@ -1,5 +1,7 @@
 // PR c++/42038
 
+// { dg-require-effective-target exceptions_enabled }
+
 extern int __cxa_begin_catch;	// { dg-message "previous declaration" }
 
 void f(void)
diff --git a/gcc/testsuite/g++.dg/parse/pr31952-2.C b/gcc/testsuite/g++.dg/parse/pr31952-2.C
index f09bcab1b85..968aabc385c 100644
--- a/gcc/testsuite/g++.dg/parse/pr31952-2.C
+++ b/gcc/testsuite/g++.dg/parse/pr31952-2.C
@@ -1,5 +1,7 @@
 // PR c++/31952
 
+// { dg-require-effective-target exceptions_enabled }
+
 void
 f0()
 {
diff --git a/gcc/testsuite/g++.dg/parse/pr31952-3.C b/gcc/testsuite/g++.dg/parse/pr31952-3.C
index 9fe5f028378..92539a39a95 100644
--- a/gcc/testsuite/g++.dg/parse/pr31952-3.C
+++ b/gcc/testsuite/g++.dg/parse/pr31952-3.C
@@ -1,5 +1,7 @@
 // PR c++/31952
 
+// { dg-require-effective-target exceptions_enabled }
+
 int
 f0 (int bar)     // { dg-message "previously" }
 try
diff --git a/gcc/testsuite/g++.dg/tm/noexcept-7.C b/gcc/testsuite/g++.dg/tm/noexcept-7.C
index bfa675c987f..c3734e86c66 100644
--- a/gcc/testsuite/g++.dg/tm/noexcept-7.C
+++ b/gcc/testsuite/g++.dg/tm/noexcept-7.C
@@ -1,4 +1,5 @@
 // FIXME the TS says atomic_noexcept calls abort, not terminate.
+// { dg-require-effective-target exceptions_enabled }
 // { dg-options "-fgnu-tm" }
 
 void f()
diff --git a/gcc/testsuite/g++.dg/torture/pr43257.C b/gcc/testsuite/g++.dg/torture/pr43257.C
index fab5f09c31a..633b7ec3465 100644
--- a/gcc/testsuite/g++.dg/torture/pr43257.C
+++ b/gcc/testsuite/g++.dg/torture/pr43257.C
@@ -1,4 +1,5 @@
 /* { dg-do assemble } */
+/* { dg-require-effective-target exceptions_enabled } */
 
 class A {};
 class B {};
diff --git a/gcc/testsuite/g++.dg/torture/pr56694.C b/gcc/testsuite/g++.dg/torture/pr56694.C
index 774bac4c615..dfaaf31c192 100644
--- a/gcc/testsuite/g++.dg/torture/pr56694.C
+++ b/gcc/testsuite/g++.dg/torture/pr56694.C
@@ -1,4 +1,5 @@
 // { dg-do compile }
+// { dg-require-effective-target exceptions_enabled }
 // { dg-options "-fopenmp" }
 // { dg-require-effective-target fopenmp }
 
diff --git a/gcc/testsuite/g++.dg/torture/pr81659.C b/gcc/testsuite/g++.dg/torture/pr81659.C
index 074099be6fc..e78483f88fe 100644
--- a/gcc/testsuite/g++.dg/torture/pr81659.C
+++ b/gcc/testsuite/g++.dg/torture/pr81659.C
@@ -1,4 +1,5 @@
 // { dg-do compile }
+// { dg-require-effective-target exceptions_enabled }
 
 void
 a (int b)
diff --git a/gcc/testsuite/g++.dg/warn/Wcatch-value-1.C b/gcc/testsuite/g++.dg/warn/Wcatch-value-1.C
index a84b337b939..9616024e0e9 100644
--- a/gcc/testsuite/g++.dg/warn/Wcatch-value-1.C
+++ b/gcc/testsuite/g++.dg/warn/Wcatch-value-1.C
@@ -1,3 +1,4 @@
+// { dg-require-effective-target exceptions_enabled }
 // { dg-options "-Wcatch-value=1" }
 
 struct A { virtual ~A() {} };
diff --git a/gcc/testsuite/g++.dg/warn/Wcatch-value-2.C b/gcc/testsuite/g++.dg/warn/Wcatch-value-2.C
index e20719c155b..43f3e00472d 100644
--- a/gcc/testsuite/g++.dg/warn/Wcatch-value-2.C
+++ b/gcc/testsuite/g++.dg/warn/Wcatch-value-2.C
@@ -1,3 +1,4 @@
+// { dg-require-effective-target exceptions_enabled }
 // { dg-options "-Wcatch-value=2" }
 
 struct A { virtual ~A() {} };
diff --git a/gcc/testsuite/g++.dg/warn/Wcatch-value-3.C b/gcc/testsuite/g++.dg/warn/Wcatch-value-3.C
index c91a3c08590..b48c989503d 100644
--- a/gcc/testsuite/g++.dg/warn/Wcatch-value-3.C
+++ b/gcc/testsuite/g++.dg/warn/Wcatch-value-3.C
@@ -1,3 +1,4 @@
+// { dg-require-effective-target exceptions_enabled }
 // { dg-options "-Wcatch-value=3" }
 
 struct A { virtual ~A() {} };
diff --git a/gcc/testsuite/g++.dg/warn/Wcatch-value-3b.C b/gcc/testsuite/g++.dg/warn/Wcatch-value-3b.C
index cb9af4a6019..47ea4671ac1 100644
--- a/gcc/testsuite/g++.dg/warn/Wcatch-value-3b.C
+++ b/gcc/testsuite/g++.dg/warn/Wcatch-value-3b.C
@@ -1,3 +1,4 @@
+// { dg-require-effective-target exceptions_enabled }
 // { dg-options "-Wcatch-value=3" }
 
 struct A { virtual ~A() {} };
diff --git a/gcc/testsuite/g++.dg/warn/Wexceptions1.C b/gcc/testsuite/g++.dg/warn/Wexceptions1.C
index af140fd0dc2..dd4c3252d39 100644
--- a/gcc/testsuite/g++.dg/warn/Wexceptions1.C
+++ b/gcc/testsuite/g++.dg/warn/Wexceptions1.C
@@ -1,5 +1,7 @@
 // PR c++/97675
 
+// { dg-require-effective-target exceptions_enabled }
+
 struct Base { };
 struct Child : Base { };
 int main() {
diff --git a/gcc/testsuite/g++.dg/warn/Wexceptions3.C b/gcc/testsuite/g++.dg/warn/Wexceptions3.C
index 97fda9dbd91..cd041ae248c 100644
--- a/gcc/testsuite/g++.dg/warn/Wexceptions3.C
+++ b/gcc/testsuite/g++.dg/warn/Wexceptions3.C
@@ -1,5 +1,7 @@
 // PR c++/81660
 
+// { dg-require-effective-target exceptions_enabled }
+
 void bar (int);
 
 void
diff --git a/gcc/testsuite/g++.dg/warn/Winfinite-recursion-3.C b/gcc/testsuite/g++.dg/warn/Winfinite-recursion-3.C
index 166e6d5790d..d4d76fba19f 100644
--- a/gcc/testsuite/g++.dg/warn/Winfinite-recursion-3.C
+++ b/gcc/testsuite/g++.dg/warn/Winfinite-recursion-3.C
@@ -1,5 +1,6 @@
 /* PR middle-end/88232 - Please implement -Winfinite-recursion
    { dg-do compile }
+   { dg-require-effective-target exceptions_enabled }
    { dg-options "-Wall -Winfinite-recursion" } */
 
 typedef __SIZE_TYPE__ size_t;
diff --git a/gcc/testsuite/g++.dg/warn/Wreturn-6.C b/gcc/testsuite/g++.dg/warn/Wreturn-6.C
index 85fef0e16df..85a1f696f20 100644
--- a/gcc/testsuite/g++.dg/warn/Wreturn-6.C
+++ b/gcc/testsuite/g++.dg/warn/Wreturn-6.C
@@ -1,5 +1,7 @@
 // PR c++/107310
 
+// { dg-require-effective-target exceptions_enabled }
+
 struct f
 {
   ~f();
diff --git a/gcc/testsuite/g++.dg/warn/Wstringop-truncation-2.C b/gcc/testsuite/g++.dg/warn/Wstringop-truncation-2.C
index ebbd44307d9..f9062f7621b 100644
--- a/gcc/testsuite/g++.dg/warn/Wstringop-truncation-2.C
+++ b/gcc/testsuite/g++.dg/warn/Wstringop-truncation-2.C
@@ -3,6 +3,7 @@
 // Compile with -g to verify the warning deals properly with debug
 // statements.
 // { dg-do compile }
+// { dg-require-effective-target exceptions_enabled }
 // { dg-options "-O2 -Wstringop-truncation -g" }
 
 extern "C" char* strncpy (char*, const char*, __SIZE_TYPE__);
diff --git a/gcc/testsuite/g++.dg/warn/Wterminate1.C b/gcc/testsuite/g++.dg/warn/Wterminate1.C
index affb48d3e8a..246555ca039 100644
--- a/gcc/testsuite/g++.dg/warn/Wterminate1.C
+++ b/gcc/testsuite/g++.dg/warn/Wterminate1.C
@@ -1,6 +1,7 @@
 // In C++98 mode this gets a -Wc++11-compat warning, in C++11 mode a
 // -Wterminate warning.
 
+// { dg-require-effective-target exceptions_enabled }
 // { dg-options "-Wall" }
 
 struct A
diff --git a/gcc/testsuite/g++.old-deja/g++.eh/catch1.C b/gcc/testsuite/g++.old-deja/g++.eh/catch1.C
index 67779d945ea..68e2c745655 100644
--- a/gcc/testsuite/g++.old-deja/g++.eh/catch1.C
+++ b/gcc/testsuite/g++.old-deja/g++.eh/catch1.C
@@ -1,4 +1,5 @@
 // { dg-do assemble  }
+// { dg-require-effective-target exceptions_enabled }
 // 
 // Copyright (C) 1999 Free Software Foundation, Inc.
 // Contributed by Nathan Sidwell 6 Jun 1999 <nathan@acm.org>
diff --git a/gcc/testsuite/g++.old-deja/g++.eh/catch10.C b/gcc/testsuite/g++.old-deja/g++.eh/catch10.C
index 7cc609645a2..c085c9b39e0 100644
--- a/gcc/testsuite/g++.old-deja/g++.eh/catch10.C
+++ b/gcc/testsuite/g++.old-deja/g++.eh/catch10.C
@@ -1,4 +1,5 @@
 // { dg-do assemble  }
+// { dg-require-effective-target exceptions_enabled }
 // Test that we notice unfortunate handler ordering.
 
 struct A { };
diff --git a/gcc/testsuite/g++.old-deja/g++.eh/cond1.C b/gcc/testsuite/g++.old-deja/g++.eh/cond1.C
index fe6d4296ab5..a7fcf890099 100644
--- a/gcc/testsuite/g++.old-deja/g++.eh/cond1.C
+++ b/gcc/testsuite/g++.old-deja/g++.eh/cond1.C
@@ -1,4 +1,5 @@
 // { dg-do assemble  }
+// { dg-require-effective-target exceptions_enabled }
 
 // Copyright (C) 1999, 2000 Free Software Foundation, Inc.
 // Contributed by Nathan Sidwell 11 Apr 1999 <nathan@acm.org>
diff --git a/gcc/testsuite/g++.old-deja/g++.eh/ctor1.C b/gcc/testsuite/g++.old-deja/g++.eh/ctor1.C
index cc39ac3953f..b3b0ce2d00c 100644
--- a/gcc/testsuite/g++.old-deja/g++.eh/ctor1.C
+++ b/gcc/testsuite/g++.old-deja/g++.eh/ctor1.C
@@ -1,4 +1,6 @@
 // { dg-do assemble  }
+// { dg-require-effective-target exceptions_enabled }
+
 struct A
 {
   A();
diff --git a/gcc/testsuite/g++.old-deja/g++.eh/throw2.C b/gcc/testsuite/g++.old-deja/g++.eh/throw2.C
index 957c200f8af..b7acb6206b2 100644
--- a/gcc/testsuite/g++.old-deja/g++.eh/throw2.C
+++ b/gcc/testsuite/g++.old-deja/g++.eh/throw2.C
@@ -1,4 +1,5 @@
 // { dg-do assemble  }
+// { dg-require-effective-target exceptions_enabled }
 
 // Submitted by Sebastian Ritterbusch <uabp@rz.uni-karlsruhe.de>
 
diff --git a/gcc/testsuite/g++.old-deja/g++.other/cond5.C b/gcc/testsuite/g++.old-deja/g++.other/cond5.C
index 0d2baf9edf7..9474c35f252 100644
--- a/gcc/testsuite/g++.old-deja/g++.other/cond5.C
+++ b/gcc/testsuite/g++.old-deja/g++.other/cond5.C
@@ -1,4 +1,5 @@
 // { dg-do assemble  }
+// { dg-require-effective-target exceptions_enabled }
 // { dg-options "-W -pedantic -ansi" }
 
 // Copyright (C) 1999, 2000 Free Software Foundation, Inc.
-- 
2.34.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Skip a number of C++ "split files" test cases for '-fno-exceptions' testing (was: Skip a number of C++ test cases for '-fno-exceptions' testing (was: Support in the GCC(/C++) test suites for '-fno-exceptions'))
  2023-06-15 15:15   ` Skip a number of C++ test cases for '-fno-exceptions' " Thomas Schwinge
@ 2023-06-15 15:47     ` Thomas Schwinge
  2023-11-03 11:08       ` Skip a number of 'g++.dg/compat/' test cases for '-fno-exceptions' testing (was: Skip a number of C++ "split files" test cases for '-fno-exceptions' testing (was: Skip a number of C++ test cases for '-fno-exceptions' testing (was: Support in the GCC(/C++) test suites for '-fno-exceptions'))) Thomas Schwinge
  2023-11-03 11:10       ` Skip a number of 'g++.dg/lto/' " Thomas Schwinge
  2023-06-15 16:04     ` Skip a number of C++ 'g++.dg/tree-prof/' test cases for '-fno-exceptions' testing (was: Skip a number of C++ test cases for '-fno-exceptions' testing (was: Support in the GCC(/C++) test suites for '-fno-exceptions')) Thomas Schwinge
  2023-09-08 13:30     ` Skip a number of C++ test cases for '-fno-exceptions' testing (was: Support in the GCC(/C++) test suites for '-fno-exceptions') Thomas Schwinge
  2 siblings, 2 replies; 14+ messages in thread
From: Thomas Schwinge @ 2023-06-15 15:47 UTC (permalink / raw)
  To: gcc-patches, Jason Merrill, Nathan Sidwell; +Cc: Jonathan Wakely

[-- Attachment #1: Type: text/plain, Size: 4396 bytes --]

Hi!

On 2023-06-15T17:15:54+0200, I wrote:
> On 2023-06-06T20:31:21+0100, Jonathan Wakely <jwakely@redhat.com> wrote:
>> On Tue, 6 Jun 2023 at 20:14, Thomas Schwinge <thomas@codesourcery.com> wrote:
>>> This issue comes up in context of me working on C++ support for GCN and
>>> nvptx target.  Those targets shall default to '-fno-exceptions' -- or,
>>> "in other words", '-fexceptions' is not supported.  (Details omitted
>>> here.)
>>>
>>> It did seem clear to me that with such a configuration it'll be hard to
>>> get clean test results.  Then I found code in
>>> 'gcc/testsuite/lib/gcc-dg.exp:gcc-dg-prune':
>>>
>>>     # If exceptions are disabled, mark tests expecting exceptions to be enabled
>>>     # as unsupported.
>>>     if { ![check_effective_target_exceptions_enabled] } {
>>>         if [regexp "(^|\n)\[^\n\]*: error: exception handling disabled" $text] {
>>>             return "::unsupported::exception handling disabled"
>>>         }
>>>
>>> ..., which, in a way, sounds as if the test suite generally is meant to
>>> produce useful results for '-fno-exceptions', nice surprise!
>>>
>>> Running x86_64-pc-linux-gnu (not yet GCN, nvptx) 'make check' with:
>>>
>>>     RUNTESTFLAGS='--target_board=unix/-fno-exceptions\{,-m32\}'
>>>
>>> ..., I find that indeed this does work for a lot of test cases, where we
>>> then get (random example):
>>>
>>>      PASS: g++.dg/coroutines/pr99710.C  (test for errors, line 23)
>>>     -PASS: g++.dg/coroutines/pr99710.C (test for excess errors)
>>>     +UNSUPPORTED: g++.dg/coroutines/pr99710.C: exception handling disabled
>>>
>>> ..., due to:
>>>
>>>      [...]/g++.dg/coroutines/pr99710.C: In function 'task my_coro()':
>>>     +[...]/g++.dg/coroutines/pr99710.C:18:10: error: exception handling
>>> disabled, use '-fexceptions' to enable
>>>      [...]/g++.dg/coroutines/pr99710.C:23:7: error: await expressions are
>>> not permitted in handlers
>>>      compiler exited with status 1
>>>
>>> But, we're nowhere near clean test results: PASS -> FAIL as well as
>>> XFAIL -> XPASS regressions, due to 'error: exception handling disabled'
>>> precluding other diagnostics seems to be one major issue.
>>>
>>> Is there interest in me producing the obvious (?) changes to those test
>>> cases, such that compiler g++ as well as target library libstdc++ test
>>> results are reasonably clean?  (If you think that's all "wasted effort",
>>> then I suppose I'll just locally ignore any FAILs/XPASSes/UNRESOLVEDs
>>> that appear in combination with
>>> 'UNSUPPORTED: [...]: exception handling disabled'.)
>>
>> I would welcome that for libstdc++. [...]

> Not having heard anything contrary regarding the compiler side of things,
> I've now been working on that, see below.

>>> Otherwise, a number of test cases need DejaGnu directives
>>> conditionalized on 'target exceptions_enabled'.
>
> Before I get to such things, even simpler: OK to push the attached
> "Skip a number of C++ test cases for '-fno-exceptions' testing"?

Similarly, OK to push the attached
"Skip a number of C++ "split files" test cases for '-fno-exceptions' testing"?


Grüße
 Thomas


>>> (Or,
>>> 'error: exception handling disabled' made a "really late" diagnostic, so
>>> that it doesn't preclude other diagnostics?  I'll have a look.  Well,
>>> maybe something like: in fact do not default to '-fno-exceptions', but
>>> instead emit 'error: exception handling disabled' only if in a "really
>>> late" pass we run into exceptions-related constructs that we cannot
>>> support.  That'd also avoid PASS -> UNSUPPORTED "regressions" when
>>> exception handling in fact gets optimized away, for example.  I like that
>>> idea, conceptually -- but is it feasible to implement..?)
>>
>> IMHO just [...] using [an effective target keyword] in test
>> selectors seems simpler, and doesn't require changes to the compiler, just
>> the tests.
>
> I still like the idea, but yes, I've mentally put it on file "for later"
> (ha, ha, ha...) -- it doesn't seem obvious to implement.
>
>
> Grüße
>  Thomas


-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Skip-a-number-of-C-split-files-test-cases-for-fno-ex.patch --]
[-- Type: text/x-diff, Size: 10828 bytes --]

From ff03a142dcdb8e2225a57f62bbc7679c384e88e5 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Wed, 7 Jun 2023 16:11:11 +0200
Subject: [PATCH] Skip a number of C++ "split files" test cases for
 '-fno-exceptions' testing

Running 'make check' with: 'RUNTESTFLAGS=--target_board=unix/-fno-exceptions',
'error: exception handling disabled' is triggered for C++ 'throw' etc. usage,
and per 'gcc/testsuite/lib/gcc-dg.exp:gcc-dg-prune':

    # If exceptions are disabled, mark tests expecting exceptions to be enabled
    # as unsupported.
    if { ![check_effective_target_exceptions_enabled] } {
        if [regexp "(^|\n)\[^\n\]*: error: exception handling disabled" $text] {
          return "::unsupported::exception handling disabled"
        }

..., which generally means:

    -PASS: [...] (test for excess errors)
    +UNSUPPORTED: [...]: exception handling disabled

However, this doesn't work for "split files" test cases.  For example:

    PASS: g++.dg/compat/eh/ctor1 cp_compat_main_tst.o compile
    [-PASS:-]{+UNSUPPORTED:+} g++.dg/compat/eh/ctor1 cp_compat_x_tst.o [-compile-]{+compile: exception handling disabled+}
    [-PASS:-]{+UNSUPPORTED:+} g++.dg/compat/eh/ctor1 cp_compat_y_tst.o [-compile-]{+compile: exception handling disabled+}
    [-PASS:-]{+UNRESOLVED:+} g++.dg/compat/eh/ctor1 cp_compat_x_tst.o-cp_compat_y_tst.o link
    [-PASS:-]{+UNRESOLVED:+} g++.dg/compat/eh/ctor1 cp_compat_x_tst.o-cp_compat_y_tst.o execute

..., or:

    [-PASS:-]{+UNSUPPORTED:+} g++.dg/lto/20081109-1 cp_lto_20081109-1_0.o [-assemble,-]{+assemble: exception handling disabled+}
    {+UNRESOLVED: g++.dg/lto/20081109-1 cp_lto_20081109-1_0.o-cp_lto_20081109-1_0.o execute+} -fPIC -flto -flto-partition=1to1
    [-PASS:-]{+UNRESOLVED:+} g++.dg/lto/20081109-1 cp_lto_20081109-1_0.o-cp_lto_20081109-1_0.o [-link,-]{+link+} -fPIC -flto -flto-partition=1to1

The "compile"/"assemble" ones (either continue to work, or) result in the
expected 'UNSUPPORTED: [...] compile: exception handling disabled', but
"link" and "execute" ones then turn UNRESOLVED.

Specify 'dg-require-effective-target exceptions_enabled' for those test cases.

	gcc/testsuite/
	* g++.dg/compat/eh/ctor1_main.C: Specify
	'dg-require-effective-target exceptions_enabled'.
	* g++.dg/compat/eh/ctor2_main.C: Likewise.
	* g++.dg/compat/eh/dtor1_main.C: Likewise.
	* g++.dg/compat/eh/filter1_main.C: Likewise.
	* g++.dg/compat/eh/filter2_main.C: Likewise.
	* g++.dg/compat/eh/new1_main.C: Likewise.
	* g++.dg/compat/eh/nrv1_main.C: Likewise.
	* g++.dg/compat/eh/spec3_main.C: Likewise.
	* g++.dg/compat/eh/template1_main.C: Likewise.
	* g++.dg/compat/eh/unexpected1_main.C: Likewise.
	* g++.dg/compat/init/array5_main.C: Likewise.
	* g++.dg/lto/20081109-1_0.C: Likewise.
	* g++.dg/lto/20081109_0.C: Likewise.
	* g++.dg/lto/20091026-1_0.C: Likewise.
	* g++.dg/lto/pr87906_0.C: Likewise.
	* g++.dg/lto/pr88046_0.C: Likewise.
---
 gcc/testsuite/g++.dg/compat/eh/ctor1_main.C       | 2 ++
 gcc/testsuite/g++.dg/compat/eh/ctor2_main.C       | 2 ++
 gcc/testsuite/g++.dg/compat/eh/dtor1_main.C       | 2 ++
 gcc/testsuite/g++.dg/compat/eh/filter1_main.C     | 2 ++
 gcc/testsuite/g++.dg/compat/eh/filter2_main.C     | 2 ++
 gcc/testsuite/g++.dg/compat/eh/new1_main.C        | 2 ++
 gcc/testsuite/g++.dg/compat/eh/nrv1_main.C        | 2 ++
 gcc/testsuite/g++.dg/compat/eh/spec3_main.C       | 2 ++
 gcc/testsuite/g++.dg/compat/eh/template1_main.C   | 2 ++
 gcc/testsuite/g++.dg/compat/eh/unexpected1_main.C | 2 ++
 gcc/testsuite/g++.dg/compat/init/array5_main.C    | 2 ++
 gcc/testsuite/g++.dg/lto/20081109-1_0.C           | 1 +
 gcc/testsuite/g++.dg/lto/20081109_0.C             | 2 ++
 gcc/testsuite/g++.dg/lto/20091026-1_0.C           | 1 +
 gcc/testsuite/g++.dg/lto/pr87906_0.C              | 1 +
 gcc/testsuite/g++.dg/lto/pr88046_0.C              | 1 +
 16 files changed, 28 insertions(+)

diff --git a/gcc/testsuite/g++.dg/compat/eh/ctor1_main.C b/gcc/testsuite/g++.dg/compat/eh/ctor1_main.C
index a188b46da86..bd766a1dc10 100644
--- a/gcc/testsuite/g++.dg/compat/eh/ctor1_main.C
+++ b/gcc/testsuite/g++.dg/compat/eh/ctor1_main.C
@@ -4,6 +4,8 @@
 
 // Split into pieces for binary compatibility testing October 2002
 
+// { dg-require-effective-target exceptions_enabled }
+
 extern void ctor1_x (void);
 
 int
diff --git a/gcc/testsuite/g++.dg/compat/eh/ctor2_main.C b/gcc/testsuite/g++.dg/compat/eh/ctor2_main.C
index 58836e26eba..10e26cd168b 100644
--- a/gcc/testsuite/g++.dg/compat/eh/ctor2_main.C
+++ b/gcc/testsuite/g++.dg/compat/eh/ctor2_main.C
@@ -4,6 +4,8 @@
 
 // Split into pieces for binary compatibility testing October 2002
 
+// { dg-require-effective-target exceptions_enabled }
+
 extern void ctor2_x (void);
 
 int main ()
diff --git a/gcc/testsuite/g++.dg/compat/eh/dtor1_main.C b/gcc/testsuite/g++.dg/compat/eh/dtor1_main.C
index 962fa64274b..733c42154e0 100644
--- a/gcc/testsuite/g++.dg/compat/eh/dtor1_main.C
+++ b/gcc/testsuite/g++.dg/compat/eh/dtor1_main.C
@@ -5,6 +5,8 @@
 
 // Split into pieces for binary compatibility testing October 2002
 
+// { dg-require-effective-target exceptions_enabled }
+
 extern void dtor1_x (void);
 
 int
diff --git a/gcc/testsuite/g++.dg/compat/eh/filter1_main.C b/gcc/testsuite/g++.dg/compat/eh/filter1_main.C
index 2a8fca42c31..797da5d4d36 100644
--- a/gcc/testsuite/g++.dg/compat/eh/filter1_main.C
+++ b/gcc/testsuite/g++.dg/compat/eh/filter1_main.C
@@ -2,6 +2,8 @@
 
 // Split into pieces for binary compatibility testing October 2002
 
+// { dg-require-effective-target exceptions_enabled }
+
 extern void filter1_x (void);
 
 int
diff --git a/gcc/testsuite/g++.dg/compat/eh/filter2_main.C b/gcc/testsuite/g++.dg/compat/eh/filter2_main.C
index 866199c6b30..297eef1f3af 100644
--- a/gcc/testsuite/g++.dg/compat/eh/filter2_main.C
+++ b/gcc/testsuite/g++.dg/compat/eh/filter2_main.C
@@ -3,6 +3,8 @@
 
 // Split into pieces for binary compatibility testing October 2002
 
+// { dg-require-effective-target exceptions_enabled }
+
 extern void filter2_x (void);
 
 int
diff --git a/gcc/testsuite/g++.dg/compat/eh/new1_main.C b/gcc/testsuite/g++.dg/compat/eh/new1_main.C
index ee4cad8e50d..d08cc41d779 100644
--- a/gcc/testsuite/g++.dg/compat/eh/new1_main.C
+++ b/gcc/testsuite/g++.dg/compat/eh/new1_main.C
@@ -4,6 +4,8 @@
 
 // Split into pieces for binary compatibility testing October 2002
 
+// { dg-require-effective-target exceptions_enabled }
+
 extern void new1_x (void);
 
 int
diff --git a/gcc/testsuite/g++.dg/compat/eh/nrv1_main.C b/gcc/testsuite/g++.dg/compat/eh/nrv1_main.C
index 3b76b5c8824..1b813f12f3a 100644
--- a/gcc/testsuite/g++.dg/compat/eh/nrv1_main.C
+++ b/gcc/testsuite/g++.dg/compat/eh/nrv1_main.C
@@ -3,6 +3,8 @@
 
 // Split into pieces for binary compatibility testing October 2002
 
+// { dg-require-effective-target exceptions_enabled }
+
 extern void nrv1_x (void);
 
 int
diff --git a/gcc/testsuite/g++.dg/compat/eh/spec3_main.C b/gcc/testsuite/g++.dg/compat/eh/spec3_main.C
index 3f0e919b2ea..6c72d54c7ff 100644
--- a/gcc/testsuite/g++.dg/compat/eh/spec3_main.C
+++ b/gcc/testsuite/g++.dg/compat/eh/spec3_main.C
@@ -3,6 +3,8 @@
 
 // Split into pieces for binary compatibility testing October 2002
 
+// { dg-require-effective-target exceptions_enabled }
+
 extern void spec3_x (void);
 
 int
diff --git a/gcc/testsuite/g++.dg/compat/eh/template1_main.C b/gcc/testsuite/g++.dg/compat/eh/template1_main.C
index 2d169808c46..87b0e3f9fb4 100644
--- a/gcc/testsuite/g++.dg/compat/eh/template1_main.C
+++ b/gcc/testsuite/g++.dg/compat/eh/template1_main.C
@@ -3,6 +3,8 @@
 
 // Split into pieces for binary compatibility testing October 2002
 
+// { dg-require-effective-target exceptions_enabled }
+
 extern void template1_x (void);
 
 int
diff --git a/gcc/testsuite/g++.dg/compat/eh/unexpected1_main.C b/gcc/testsuite/g++.dg/compat/eh/unexpected1_main.C
index 1658db77e32..208edb4fcb3 100644
--- a/gcc/testsuite/g++.dg/compat/eh/unexpected1_main.C
+++ b/gcc/testsuite/g++.dg/compat/eh/unexpected1_main.C
@@ -3,6 +3,8 @@
 
 // Split into pieces for binary compatibility testing October 2002
 
+// { dg-require-effective-target exceptions_enabled }
+
 extern void unexpected1_x ();
 
 int
diff --git a/gcc/testsuite/g++.dg/compat/init/array5_main.C b/gcc/testsuite/g++.dg/compat/init/array5_main.C
index 96b2cc4b12b..e981f58740a 100644
--- a/gcc/testsuite/g++.dg/compat/init/array5_main.C
+++ b/gcc/testsuite/g++.dg/compat/init/array5_main.C
@@ -5,6 +5,8 @@
 // Incorrect construction and destruction of multi-dimensional
 // array of class.
 
+// { dg-require-effective-target exceptions_enabled }
+
 extern void array5_x (void);
 
 int
diff --git a/gcc/testsuite/g++.dg/lto/20081109-1_0.C b/gcc/testsuite/g++.dg/lto/20081109-1_0.C
index db0ba367fe8..f1a4b101cca 100644
--- a/gcc/testsuite/g++.dg/lto/20081109-1_0.C
+++ b/gcc/testsuite/g++.dg/lto/20081109-1_0.C
@@ -1,4 +1,5 @@
 // { dg-lto-do link }
+// { dg-require-effective-target exceptions_enabled }
 // { dg-require-effective-target fpic }
 // { dg-lto-options {{-fPIC -flto -flto-partition=1to1}} }
 // { dg-extra-ld-options "-fPIC -flto -flto-partition=1to1 -r -fno-exceptions -flinker-output=nolto-rel" }
diff --git a/gcc/testsuite/g++.dg/lto/20081109_0.C b/gcc/testsuite/g++.dg/lto/20081109_0.C
index 93cfc67fff2..6ab27d900cc 100644
--- a/gcc/testsuite/g++.dg/lto/20081109_0.C
+++ b/gcc/testsuite/g++.dg/lto/20081109_0.C
@@ -1,3 +1,5 @@
+// { dg-require-effective-target exceptions_enabled }
+
 extern "C" { void abort (void);}
 int foo (int);
 
diff --git a/gcc/testsuite/g++.dg/lto/20091026-1_0.C b/gcc/testsuite/g++.dg/lto/20091026-1_0.C
index 06eff292cb6..2b666b88282 100644
--- a/gcc/testsuite/g++.dg/lto/20091026-1_0.C
+++ b/gcc/testsuite/g++.dg/lto/20091026-1_0.C
@@ -1,4 +1,5 @@
 // { dg-lto-do link }
+// { dg-require-effective-target exceptions_enabled }
 // { dg-extra-ld-options "-r -nostdlib -flinker-output=nolto-rel" }
 
 #include "20091026-1_a.h"
diff --git a/gcc/testsuite/g++.dg/lto/pr87906_0.C b/gcc/testsuite/g++.dg/lto/pr87906_0.C
index 6a04cd5c6f0..b76855b6ed7 100644
--- a/gcc/testsuite/g++.dg/lto/pr87906_0.C
+++ b/gcc/testsuite/g++.dg/lto/pr87906_0.C
@@ -1,4 +1,5 @@
 // { dg-lto-do link }
+// { dg-require-effective-target exceptions_enabled }
 // { dg-require-effective-target fpic }
 // { dg-require-effective-target shared }
 // { dg-lto-options { { -O -fPIC -flto } } }
diff --git a/gcc/testsuite/g++.dg/lto/pr88046_0.C b/gcc/testsuite/g++.dg/lto/pr88046_0.C
index 734ce86e9b8..79efd88f210 100644
--- a/gcc/testsuite/g++.dg/lto/pr88046_0.C
+++ b/gcc/testsuite/g++.dg/lto/pr88046_0.C
@@ -1,5 +1,6 @@
 // { dg-lto-do link }
 // { dg-lto-options { { -O2 -fPIC -flto } } }
+// { dg-require-effective-target exceptions_enabled }
 // { dg-require-effective-target shared }
 // { dg-require-effective-target fpic }
 // { dg-extra-ld-options "-shared -g" }
-- 
2.34.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Skip a number of C++ 'g++.dg/tree-prof/' test cases for '-fno-exceptions' testing (was: Skip a number of C++ test cases for '-fno-exceptions' testing (was: Support in the GCC(/C++) test suites for '-fno-exceptions'))
  2023-06-15 15:15   ` Skip a number of C++ test cases for '-fno-exceptions' " Thomas Schwinge
  2023-06-15 15:47     ` Skip a number of C++ "split files" test cases for '-fno-exceptions' testing (was: Skip a number of C++ test cases for '-fno-exceptions' testing (was: Support in the GCC(/C++) test suites for '-fno-exceptions')) Thomas Schwinge
@ 2023-06-15 16:04     ` Thomas Schwinge
  2023-11-03 11:12       ` Skip a number of " Thomas Schwinge
  2023-09-08 13:30     ` Skip a number of C++ test cases for '-fno-exceptions' testing (was: Support in the GCC(/C++) test suites for '-fno-exceptions') Thomas Schwinge
  2 siblings, 1 reply; 14+ messages in thread
From: Thomas Schwinge @ 2023-06-15 16:04 UTC (permalink / raw)
  To: gcc-patches, Jason Merrill, Nathan Sidwell; +Cc: Jonathan Wakely

[-- Attachment #1: Type: text/plain, Size: 4402 bytes --]

Hi!

On 2023-06-15T17:15:54+0200, I wrote:
> On 2023-06-06T20:31:21+0100, Jonathan Wakely <jwakely@redhat.com> wrote:
>> On Tue, 6 Jun 2023 at 20:14, Thomas Schwinge <thomas@codesourcery.com> wrote:
>>> This issue comes up in context of me working on C++ support for GCN and
>>> nvptx target.  Those targets shall default to '-fno-exceptions' -- or,
>>> "in other words", '-fexceptions' is not supported.  (Details omitted
>>> here.)
>>>
>>> It did seem clear to me that with such a configuration it'll be hard to
>>> get clean test results.  Then I found code in
>>> 'gcc/testsuite/lib/gcc-dg.exp:gcc-dg-prune':
>>>
>>>     # If exceptions are disabled, mark tests expecting exceptions to be enabled
>>>     # as unsupported.
>>>     if { ![check_effective_target_exceptions_enabled] } {
>>>         if [regexp "(^|\n)\[^\n\]*: error: exception handling disabled" $text] {
>>>             return "::unsupported::exception handling disabled"
>>>         }
>>>
>>> ..., which, in a way, sounds as if the test suite generally is meant to
>>> produce useful results for '-fno-exceptions', nice surprise!
>>>
>>> Running x86_64-pc-linux-gnu (not yet GCN, nvptx) 'make check' with:
>>>
>>>     RUNTESTFLAGS='--target_board=unix/-fno-exceptions\{,-m32\}'
>>>
>>> ..., I find that indeed this does work for a lot of test cases, where we
>>> then get (random example):
>>>
>>>      PASS: g++.dg/coroutines/pr99710.C  (test for errors, line 23)
>>>     -PASS: g++.dg/coroutines/pr99710.C (test for excess errors)
>>>     +UNSUPPORTED: g++.dg/coroutines/pr99710.C: exception handling disabled
>>>
>>> ..., due to:
>>>
>>>      [...]/g++.dg/coroutines/pr99710.C: In function 'task my_coro()':
>>>     +[...]/g++.dg/coroutines/pr99710.C:18:10: error: exception handling
>>> disabled, use '-fexceptions' to enable
>>>      [...]/g++.dg/coroutines/pr99710.C:23:7: error: await expressions are
>>> not permitted in handlers
>>>      compiler exited with status 1
>>>
>>> But, we're nowhere near clean test results: PASS -> FAIL as well as
>>> XFAIL -> XPASS regressions, due to 'error: exception handling disabled'
>>> precluding other diagnostics seems to be one major issue.
>>>
>>> Is there interest in me producing the obvious (?) changes to those test
>>> cases, such that compiler g++ as well as target library libstdc++ test
>>> results are reasonably clean?  (If you think that's all "wasted effort",
>>> then I suppose I'll just locally ignore any FAILs/XPASSes/UNRESOLVEDs
>>> that appear in combination with
>>> 'UNSUPPORTED: [...]: exception handling disabled'.)
>>
>> I would welcome that for libstdc++. [...]

> Not having heard anything contrary regarding the compiler side of things,
> I've now been working on that, see below.

>>> Otherwise, a number of test cases need DejaGnu directives
>>> conditionalized on 'target exceptions_enabled'.
>
> Before I get to such things, even simpler: OK to push the attached
> "Skip a number of C++ test cases for '-fno-exceptions' testing"?

Similarly, OK to push the attached
"Skip a number of C++ 'g++.dg/tree-prof/' test cases for '-fno-exceptions' testing"?


Grüße
 Thomas


>>> (Or,
>>> 'error: exception handling disabled' made a "really late" diagnostic, so
>>> that it doesn't preclude other diagnostics?  I'll have a look.  Well,
>>> maybe something like: in fact do not default to '-fno-exceptions', but
>>> instead emit 'error: exception handling disabled' only if in a "really
>>> late" pass we run into exceptions-related constructs that we cannot
>>> support.  That'd also avoid PASS -> UNSUPPORTED "regressions" when
>>> exception handling in fact gets optimized away, for example.  I like that
>>> idea, conceptually -- but is it feasible to implement..?)
>>
>> IMHO just [...] using [an effective target keyword] in test
>> selectors seems simpler, and doesn't require changes to the compiler, just
>> the tests.
>
> I still like the idea, but yes, I've mentally put it on file "for later"
> (ha, ha, ha...) -- it doesn't seem obvious to implement.
>
>
> Grüße
>  Thomas


-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Skip-a-number-of-C-g-.dg-tree-prof-test-cases-for-fn.patch --]
[-- Type: text/x-diff, Size: 5470 bytes --]

From 9d9c1430c569e661913a3f5dc59fceaa03cc935d Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Wed, 14 Jun 2023 22:39:01 +0200
Subject: [PATCH] Skip a number of C++ 'g++.dg/tree-prof/' test cases for
 '-fno-exceptions' testing

Running 'make check' with: 'RUNTESTFLAGS=--target_board=unix/-fno-exceptions',
'error: exception handling disabled' is triggered for C++ 'throw' etc. usage,
and per 'gcc/testsuite/lib/gcc-dg.exp:gcc-dg-prune':

    # If exceptions are disabled, mark tests expecting exceptions to be enabled
    # as unsupported.
    if { ![check_effective_target_exceptions_enabled] } {
        if [regexp "(^|\n)\[^\n\]*: error: exception handling disabled" $text] {
          return "::unsupported::exception handling disabled"
        }

..., which generally means:

    -PASS: [...] (test for excess errors)
    +UNSUPPORTED: [...]: exception handling disabled

However, this doesn't work for 'g++.dg/tree-prof/' test cases.  For example:

    [-PASS: g++.dg/tree-prof/indir-call-prof-2.C compilation,  -fprofile-generate -D_PROFILE_GENERATE-]
    [-PASS:-]{+UNRESOLVED:+} g++.dg/tree-prof/indir-call-prof-2.C compilation,  -fprofile-use -D_PROFILE_USE
    [-PASS:-]{+UNSUPPORTED: g++.dg/tree-prof/indir-call-prof-2.C compilation: exception handling disabled+}
    {+UNRESOLVED:+} g++.dg/tree-prof/indir-call-prof-2.C execution,    -fprofile-generate -D_PROFILE_GENERATE
    [-PASS:-]{+UNRESOLVED:+} g++.dg/tree-prof/indir-call-prof-2.C execution,    -fprofile-use -D_PROFILE_USE

Dependent parts turn UNRESOLVED if "compilation" runs into the expected
'UNSUPPORTED: [...] compile: exception handling disabled'.

Specify 'dg-require-effective-target exceptions_enabled' for those test cases.

	gcc/testsuite/
	* g++.dg/tree-prof/indir-call-prof-2.C: Specify
	'dg-require-effective-target exceptions_enabled'.
	* g++.dg/tree-prof/partition1.C: Likewise.
	* g++.dg/tree-prof/partition2.C: Likewise.
	* g++.dg/tree-prof/partition3.C: Likewise.
	* g++.dg/tree-prof/pr51719.C: Likewise.
	* g++.dg/tree-prof/pr57451.C: Likewise.
	* g++.dg/tree-prof/pr59255.C: Likewise.
---
 gcc/testsuite/g++.dg/tree-prof/indir-call-prof-2.C | 1 +
 gcc/testsuite/g++.dg/tree-prof/partition1.C        | 1 +
 gcc/testsuite/g++.dg/tree-prof/partition2.C        | 1 +
 gcc/testsuite/g++.dg/tree-prof/partition3.C        | 1 +
 gcc/testsuite/g++.dg/tree-prof/pr51719.C           | 1 +
 gcc/testsuite/g++.dg/tree-prof/pr57451.C           | 1 +
 gcc/testsuite/g++.dg/tree-prof/pr59255.C           | 1 +
 7 files changed, 7 insertions(+)

diff --git a/gcc/testsuite/g++.dg/tree-prof/indir-call-prof-2.C b/gcc/testsuite/g++.dg/tree-prof/indir-call-prof-2.C
index e20cc64d373..497282db376 100644
--- a/gcc/testsuite/g++.dg/tree-prof/indir-call-prof-2.C
+++ b/gcc/testsuite/g++.dg/tree-prof/indir-call-prof-2.C
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target exceptions_enabled } */
 /* { dg-options "-O" } */
 
 int foo1(void) { return 0; }
diff --git a/gcc/testsuite/g++.dg/tree-prof/partition1.C b/gcc/testsuite/g++.dg/tree-prof/partition1.C
index d0dcbc4524b..a7c9cd5ba7f 100644
--- a/gcc/testsuite/g++.dg/tree-prof/partition1.C
+++ b/gcc/testsuite/g++.dg/tree-prof/partition1.C
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target exceptions_enabled } */
 /* { dg-require-effective-target freorder } */
 /* { dg-options "-O2 -freorder-blocks-and-partition" } */
 
diff --git a/gcc/testsuite/g++.dg/tree-prof/partition2.C b/gcc/testsuite/g++.dg/tree-prof/partition2.C
index 0bc50fae98a..512c1274140 100644
--- a/gcc/testsuite/g++.dg/tree-prof/partition2.C
+++ b/gcc/testsuite/g++.dg/tree-prof/partition2.C
@@ -1,4 +1,5 @@
 // PR middle-end/45458
+/* { dg-require-effective-target exceptions_enabled } */
 // { dg-require-effective-target freorder }
 // { dg-options "-O2 -fnon-call-exceptions -freorder-blocks-and-partition" }
 
diff --git a/gcc/testsuite/g++.dg/tree-prof/partition3.C b/gcc/testsuite/g++.dg/tree-prof/partition3.C
index c62174aa4d3..48a850ddfae 100644
--- a/gcc/testsuite/g++.dg/tree-prof/partition3.C
+++ b/gcc/testsuite/g++.dg/tree-prof/partition3.C
@@ -1,4 +1,5 @@
 // PR middle-end/45566
+// { dg-require-effective-target exceptions_enabled }
 // { dg-require-effective-target freorder }
 // { dg-options "-O2 -fnon-call-exceptions -freorder-blocks-and-partition" }
 
diff --git a/gcc/testsuite/g++.dg/tree-prof/pr51719.C b/gcc/testsuite/g++.dg/tree-prof/pr51719.C
index 01e81ff66ed..7c568eb537f 100644
--- a/gcc/testsuite/g++.dg/tree-prof/pr51719.C
+++ b/gcc/testsuite/g++.dg/tree-prof/pr51719.C
@@ -1,4 +1,5 @@
 // PR tree-optimization/51719
+// { dg-require-effective-target exceptions_enabled }
 // { dg-options "-O -fpartial-inlining" }
 
 int
diff --git a/gcc/testsuite/g++.dg/tree-prof/pr57451.C b/gcc/testsuite/g++.dg/tree-prof/pr57451.C
index db0fcc1e8ef..a530e9053e2 100644
--- a/gcc/testsuite/g++.dg/tree-prof/pr57451.C
+++ b/gcc/testsuite/g++.dg/tree-prof/pr57451.C
@@ -1,3 +1,4 @@
+// { dg-require-effective-target exceptions_enabled }
 // { dg-require-effective-target freorder }
 // { dg-options "-O2 -freorder-blocks-and-partition -g" }
 
diff --git a/gcc/testsuite/g++.dg/tree-prof/pr59255.C b/gcc/testsuite/g++.dg/tree-prof/pr59255.C
index 77f208a3a5f..a5ee03c2cca 100644
--- a/gcc/testsuite/g++.dg/tree-prof/pr59255.C
+++ b/gcc/testsuite/g++.dg/tree-prof/pr59255.C
@@ -1,4 +1,5 @@
 // PR c++/59255
+// { dg-require-effective-target exceptions_enabled }
 // { dg-options "-std=c++11 -O2" }
 
 struct S
-- 
2.34.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Skip a number of C++ test cases for '-fno-exceptions' testing (was: Support in the GCC(/C++) test suites for '-fno-exceptions')
  2023-06-15 15:15   ` Skip a number of C++ test cases for '-fno-exceptions' " Thomas Schwinge
  2023-06-15 15:47     ` Skip a number of C++ "split files" test cases for '-fno-exceptions' testing (was: Skip a number of C++ test cases for '-fno-exceptions' testing (was: Support in the GCC(/C++) test suites for '-fno-exceptions')) Thomas Schwinge
  2023-06-15 16:04     ` Skip a number of C++ 'g++.dg/tree-prof/' test cases for '-fno-exceptions' testing (was: Skip a number of C++ test cases for '-fno-exceptions' testing (was: Support in the GCC(/C++) test suites for '-fno-exceptions')) Thomas Schwinge
@ 2023-09-08 13:30     ` Thomas Schwinge
  2023-11-03 11:03       ` Thomas Schwinge
  2 siblings, 1 reply; 14+ messages in thread
From: Thomas Schwinge @ 2023-09-08 13:30 UTC (permalink / raw)
  To: Jason Merrill, Nathan Sidwell; +Cc: gcc-patches, libstdc++, Jonathan Wakely

[-- Attachment #1: Type: text/plain, Size: 5140 bytes --]

Hi!

GCC/C++ front end maintainers, please provide input on the overall
approach here:

On 2023-06-15T17:15:54+0200, I wrote:
> On 2023-06-06T20:31:21+0100, Jonathan Wakely <jwakely@redhat.com> wrote:
>> On Tue, 6 Jun 2023 at 20:14, Thomas Schwinge <thomas@codesourcery.com> wrote:
>>> This issue comes up in context of me working on C++ support for GCN and
>>> nvptx target.  Those targets shall default to '-fno-exceptions' -- or,
>>> "in other words", '-fexceptions' is not supported.  (Details omitted
>>> here.)
>>>
>>> It did seem clear to me that with such a configuration it'll be hard to
>>> get clean test results.  Then I found code in
>>> 'gcc/testsuite/lib/gcc-dg.exp:gcc-dg-prune':
>>>
>>>     # If exceptions are disabled, mark tests expecting exceptions to be enabled
>>>     # as unsupported.
>>>     if { ![check_effective_target_exceptions_enabled] } {
>>>         if [regexp "(^|\n)\[^\n\]*: error: exception handling disabled" $text] {
>>>             return "::unsupported::exception handling disabled"
>>>         }
>>>
>>> ..., which, in a way, sounds as if the test suite generally is meant to
>>> produce useful results for '-fno-exceptions', nice surprise!
>>>
>>> Running x86_64-pc-linux-gnu (not yet GCN, nvptx) 'make check' with:
>>>
>>>     RUNTESTFLAGS='--target_board=unix/-fno-exceptions\{,-m32\}'
>>>
>>> ..., I find that indeed this does work for a lot of test cases, where we
>>> then get (random example):
>>>
>>>      PASS: g++.dg/coroutines/pr99710.C  (test for errors, line 23)
>>>     -PASS: g++.dg/coroutines/pr99710.C (test for excess errors)
>>>     +UNSUPPORTED: g++.dg/coroutines/pr99710.C: exception handling disabled
>>>
>>> ..., due to:
>>>
>>>      [...]/g++.dg/coroutines/pr99710.C: In function 'task my_coro()':
>>>     +[...]/g++.dg/coroutines/pr99710.C:18:10: error: exception handling disabled, use '-fexceptions' to enable
>>>      [...]/g++.dg/coroutines/pr99710.C:23:7: error: await expressions are not permitted in handlers
>>>      compiler exited with status 1
>>>
>>> But, we're nowhere near clean test results: PASS -> FAIL as well as
>>> XFAIL -> XPASS regressions, due to 'error: exception handling disabled'
>>> precluding other diagnostics seems to be one major issue.
>>>
>>> Is there interest in me producing the obvious (?) changes to those test
>>> cases, such that compiler g++ as well as target library libstdc++ test
>>> results are reasonably clean?  (If you think that's all "wasted effort",
>>> then I suppose I'll just locally ignore any FAILs/XPASSes/UNRESOLVEDs
>>> that appear in combination with
>>> 'UNSUPPORTED: [...]: exception handling disabled'.)
>>
>> I would welcome that for libstdc++. [...]

> Per your and my changes a few days ago, we've already got libstdc++
> covered, [...]

> Not having heard anything contrary regarding the compiler side of things,
> I've now been working on that, see below.
>
>> We already have a handful of tests that use #if __cpp_exceptions to make
>> those parts conditional on exception support.
>
> Yes, that's an option not for all but certainly for some test cases.
> (I'm not looking into that now -- but this may in fact be a good
> beginner-level task, will add to <https://gcc.gnu.org/wiki/EasyHacks>).
>
>>> Otherwise, a number of test cases need DejaGnu directives
>>> conditionalized on 'target exceptions_enabled'.
>
> Before I get to such things, even simpler: OK to push the attached
> "Skip a number of C++ test cases for '-fno-exceptions' testing"?

I've re-attached my patch from a few months ago:
"Skip a number of C++ test cases for '-fno-exceptions' testing".
(I'd obviously re-check for current master branch before 'git push'.)

If there is interest in this at all, I'd then later complete and submit
my more or less WIP patches for the slightly more involved test case
scenarios.


Grüße
 Thomas


>>> (Or,
>>> 'error: exception handling disabled' made a "really late" diagnostic, so
>>> that it doesn't preclude other diagnostics?  I'll have a look.  Well,
>>> maybe something like: in fact do not default to '-fno-exceptions', but
>>> instead emit 'error: exception handling disabled' only if in a "really
>>> late" pass we run into exceptions-related constructs that we cannot
>>> support.  That'd also avoid PASS -> UNSUPPORTED "regressions" when
>>> exception handling in fact gets optimized away, for example.  I like that
>>> idea, conceptually -- but is it feasible to implement..?)
>>
>> IMHO just [...] using [an effective target keyword] in test
>> selectors seems simpler, and doesn't require changes to the compiler, just
>> the tests.
>
> I still like the idea, but yes, I've mentally put it on file "for later"
> (ha, ha, ha...) -- it doesn't seem obvious to implement.
>
>
> Grüße
>  Thomas


-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Skip-a-number-of-C-test-cases-for-fno-exceptions-tes.patch --]
[-- Type: text/x-diff, Size: 27888 bytes --]

From fb7847774109c47708bc0fe26270d89a0db8ae0b Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Wed, 7 Jun 2023 14:14:44 +0200
Subject: [PATCH] Skip a number of C++ test cases for '-fno-exceptions' testing

Running 'make check' with: 'RUNTESTFLAGS=--target_board=unix/-fno-exceptions',
'error: exception handling disabled' is triggered for C++ 'throw' etc. usage,
and per 'gcc/testsuite/lib/gcc-dg.exp:gcc-dg-prune':

    # If exceptions are disabled, mark tests expecting exceptions to be enabled
    # as unsupported.
    if { ![check_effective_target_exceptions_enabled] } {
	if [regexp "(^|\n)\[^\n\]*: error: exception handling disabled" $text] {
	    return "::unsupported::exception handling disabled"
	}

..., which generally means:

    -PASS: [...] (test for excess errors)
    +UNSUPPORTED: [...]: exception handling disabled

However, if there are additional 'dg-error' etc. directives, these may regress
PASS -> FAIL (or similar) -- if their associated diagnostics are precluded by
'error: exception handling disabled'.  For example:

    PASS: g++.dg/cpp2a/explicit1.C    (test for errors, line 43)
    PASS: g++.dg/cpp2a/explicit1.C    (test for errors, line 47)
    [-PASS:-]{+FAIL:+} g++.dg/cpp2a/explicit1.C    (test for errors, line 50)
    [-PASS:-]{+FAIL:+} g++.dg/cpp2a/explicit1.C    (test for errors, line 51)
    PASS: g++.dg/cpp2a/explicit1.C    (test for errors, line 52)
    PASS: g++.dg/cpp2a/explicit1.C    (test for errors, line 53)
    PASS: g++.dg/cpp2a/explicit1.C    (test for errors, line 59)
    [-PASS:-]{+UNSUPPORTED:+} g++.dg/cpp2a/explicit1.C  [-(test for excess errors)-]{+: exception handling disabled+}

Specify 'dg-require-effective-target exceptions_enabled' for those test cases.

	gcc/testsuite/
	* g++.dg/coroutines/pr95616-0.C: Specify
	'dg-require-effective-target exceptions_enabled'.
	* g++.dg/coroutines/pr95616-1.C: Likewise.
	* g++.dg/coroutines/pr95616-2.C: Likewise.
	* g++.dg/coroutines/pr95616-3.C: Likewise.
	* g++.dg/coroutines/pr95616-4.C: Likewise.
	* g++.dg/coroutines/pr95616-5.C: Likewise.
	* g++.dg/coroutines/pr95616-6.C: Likewise.
	* g++.dg/cpp0x/catch1.C: Likewise.
	* g++.dg/cpp0x/constexpr-throw.C: Likewise.
	* g++.dg/cpp1y/constexpr-89785-2.C: Likewise.
	* g++.dg/cpp1y/constexpr-throw.C: Likewise.
	* g++.dg/cpp1y/pr79393-3.C: Likewise.
	* g++.dg/cpp2a/consteval-memfn1.C: Likewise.
	* g++.dg/cpp2a/consteval11.C: Likewise.
	* g++.dg/cpp2a/consteval9.C: Likewise.
	* g++.dg/cpp2a/explicit1.C: Likewise.
	* g++.dg/cpp2a/explicit2.C: Likewise.
	* g++.dg/cpp2a/explicit5.C: Likewise.
	* g++.dg/eh/builtin10.C: Likewise.
	* g++.dg/eh/builtin11.C: Likewise.
	* g++.dg/eh/builtin6.C: Likewise.
	* g++.dg/eh/builtin7.C: Likewise.
	* g++.dg/eh/builtin9.C: Likewise.
	* g++.dg/eh/dtor4.C: Likewise.
	* g++.dg/eh/pr42859.C: Likewise.
	* g++.dg/ext/stmtexpr25.C: Likewise.
	* g++.dg/ext/vla4.C: Likewise.
	* g++.dg/init/placement4.C: Likewise.
	* g++.dg/other/error32.C: Likewise.
	* g++.dg/parse/crash55.C: Likewise.
	* g++.dg/parse/pr31952-2.C: Likewise.
	* g++.dg/parse/pr31952-3.C: Likewise.
	* g++.dg/tm/noexcept-7.C: Likewise.
	* g++.dg/torture/pr43257.C: Likewise.
	* g++.dg/torture/pr56694.C: Likewise.
	* g++.dg/torture/pr81659.C: Likewise.
	* g++.dg/warn/Wcatch-value-1.C: Likewise.
	* g++.dg/warn/Wcatch-value-2.C: Likewise.
	* g++.dg/warn/Wcatch-value-3.C: Likewise.
	* g++.dg/warn/Wcatch-value-3b.C: Likewise.
	* g++.dg/warn/Wexceptions1.C: Likewise.
	* g++.dg/warn/Wexceptions3.C: Likewise.
	* g++.dg/warn/Winfinite-recursion-3.C: Likewise.
	* g++.dg/warn/Wreturn-6.C: Likewise.
	* g++.dg/warn/Wstringop-truncation-2.C: Likewise.
	* g++.dg/warn/Wterminate1.C: Likewise.
	* g++.old-deja/g++.eh/catch1.C: Likewise.
	* g++.old-deja/g++.eh/catch10.C: Likewise.
	* g++.old-deja/g++.eh/cond1.C: Likewise.
	* g++.old-deja/g++.eh/ctor1.C: Likewise.
	* g++.old-deja/g++.eh/throw2.C: Likewise.
	* g++.old-deja/g++.other/cond5.C: Likewise.
---
 gcc/testsuite/g++.dg/coroutines/pr95616-0.C        | 1 +
 gcc/testsuite/g++.dg/coroutines/pr95616-1.C        | 1 +
 gcc/testsuite/g++.dg/coroutines/pr95616-2.C        | 1 +
 gcc/testsuite/g++.dg/coroutines/pr95616-3.C        | 1 +
 gcc/testsuite/g++.dg/coroutines/pr95616-4.C        | 1 +
 gcc/testsuite/g++.dg/coroutines/pr95616-5.C        | 1 +
 gcc/testsuite/g++.dg/coroutines/pr95616-6.C        | 1 +
 gcc/testsuite/g++.dg/cpp0x/catch1.C                | 1 +
 gcc/testsuite/g++.dg/cpp0x/constexpr-throw.C       | 1 +
 gcc/testsuite/g++.dg/cpp1y/constexpr-89785-2.C     | 1 +
 gcc/testsuite/g++.dg/cpp1y/constexpr-throw.C       | 1 +
 gcc/testsuite/g++.dg/cpp1y/pr79393-3.C             | 1 +
 gcc/testsuite/g++.dg/cpp2a/consteval-memfn1.C      | 1 +
 gcc/testsuite/g++.dg/cpp2a/consteval11.C           | 1 +
 gcc/testsuite/g++.dg/cpp2a/consteval9.C            | 1 +
 gcc/testsuite/g++.dg/cpp2a/explicit1.C             | 1 +
 gcc/testsuite/g++.dg/cpp2a/explicit2.C             | 1 +
 gcc/testsuite/g++.dg/cpp2a/explicit5.C             | 1 +
 gcc/testsuite/g++.dg/eh/builtin10.C                | 1 +
 gcc/testsuite/g++.dg/eh/builtin11.C                | 1 +
 gcc/testsuite/g++.dg/eh/builtin6.C                 | 1 +
 gcc/testsuite/g++.dg/eh/builtin7.C                 | 1 +
 gcc/testsuite/g++.dg/eh/builtin9.C                 | 1 +
 gcc/testsuite/g++.dg/eh/dtor4.C                    | 2 ++
 gcc/testsuite/g++.dg/eh/pr42859.C                  | 1 +
 gcc/testsuite/g++.dg/ext/stmtexpr25.C              | 1 +
 gcc/testsuite/g++.dg/ext/vla4.C                    | 1 +
 gcc/testsuite/g++.dg/init/placement4.C             | 2 ++
 gcc/testsuite/g++.dg/other/error32.C               | 1 +
 gcc/testsuite/g++.dg/parse/crash55.C               | 2 ++
 gcc/testsuite/g++.dg/parse/pr31952-2.C             | 2 ++
 gcc/testsuite/g++.dg/parse/pr31952-3.C             | 2 ++
 gcc/testsuite/g++.dg/tm/noexcept-7.C               | 1 +
 gcc/testsuite/g++.dg/torture/pr43257.C             | 1 +
 gcc/testsuite/g++.dg/torture/pr56694.C             | 1 +
 gcc/testsuite/g++.dg/torture/pr81659.C             | 1 +
 gcc/testsuite/g++.dg/warn/Wcatch-value-1.C         | 1 +
 gcc/testsuite/g++.dg/warn/Wcatch-value-2.C         | 1 +
 gcc/testsuite/g++.dg/warn/Wcatch-value-3.C         | 1 +
 gcc/testsuite/g++.dg/warn/Wcatch-value-3b.C        | 1 +
 gcc/testsuite/g++.dg/warn/Wexceptions1.C           | 2 ++
 gcc/testsuite/g++.dg/warn/Wexceptions3.C           | 2 ++
 gcc/testsuite/g++.dg/warn/Winfinite-recursion-3.C  | 1 +
 gcc/testsuite/g++.dg/warn/Wreturn-6.C              | 2 ++
 gcc/testsuite/g++.dg/warn/Wstringop-truncation-2.C | 1 +
 gcc/testsuite/g++.dg/warn/Wterminate1.C            | 1 +
 gcc/testsuite/g++.old-deja/g++.eh/catch1.C         | 1 +
 gcc/testsuite/g++.old-deja/g++.eh/catch10.C        | 1 +
 gcc/testsuite/g++.old-deja/g++.eh/cond1.C          | 1 +
 gcc/testsuite/g++.old-deja/g++.eh/ctor1.C          | 2 ++
 gcc/testsuite/g++.old-deja/g++.eh/throw2.C         | 1 +
 gcc/testsuite/g++.old-deja/g++.other/cond5.C       | 1 +
 52 files changed, 61 insertions(+)

diff --git a/gcc/testsuite/g++.dg/coroutines/pr95616-0.C b/gcc/testsuite/g++.dg/coroutines/pr95616-0.C
index e500b6ea636..3d0cc59fbb8 100644
--- a/gcc/testsuite/g++.dg/coroutines/pr95616-0.C
+++ b/gcc/testsuite/g++.dg/coroutines/pr95616-0.C
@@ -1,3 +1,4 @@
+//  { dg-require-effective-target exceptions_enabled }
 //  { dg-additional-options "-fsyntax-only" }
 
 #if __has_include(<coroutine>)
diff --git a/gcc/testsuite/g++.dg/coroutines/pr95616-1.C b/gcc/testsuite/g++.dg/coroutines/pr95616-1.C
index c3989804e6b..2c7d7f2f6e8 100644
--- a/gcc/testsuite/g++.dg/coroutines/pr95616-1.C
+++ b/gcc/testsuite/g++.dg/coroutines/pr95616-1.C
@@ -1,3 +1,4 @@
+//  { dg-require-effective-target exceptions_enabled }
 //  { dg-additional-options "-fsyntax-only" }
 
 #if __has_include(<coroutine>)
diff --git a/gcc/testsuite/g++.dg/coroutines/pr95616-2.C b/gcc/testsuite/g++.dg/coroutines/pr95616-2.C
index 6ad251986ec..671a3f30a3a 100644
--- a/gcc/testsuite/g++.dg/coroutines/pr95616-2.C
+++ b/gcc/testsuite/g++.dg/coroutines/pr95616-2.C
@@ -1,3 +1,4 @@
+//  { dg-require-effective-target exceptions_enabled }
 //  { dg-additional-options "-fsyntax-only" }
 
 #if __has_include(<coroutine>)
diff --git a/gcc/testsuite/g++.dg/coroutines/pr95616-3.C b/gcc/testsuite/g++.dg/coroutines/pr95616-3.C
index 7da1f6a9658..e650d89e92a 100644
--- a/gcc/testsuite/g++.dg/coroutines/pr95616-3.C
+++ b/gcc/testsuite/g++.dg/coroutines/pr95616-3.C
@@ -1,3 +1,4 @@
+//  { dg-require-effective-target exceptions_enabled }
 //  { dg-additional-options "-fsyntax-only" }
 
 #if __has_include(<coroutine>)
diff --git a/gcc/testsuite/g++.dg/coroutines/pr95616-4.C b/gcc/testsuite/g++.dg/coroutines/pr95616-4.C
index ef6a160a5c4..b783a9d338c 100644
--- a/gcc/testsuite/g++.dg/coroutines/pr95616-4.C
+++ b/gcc/testsuite/g++.dg/coroutines/pr95616-4.C
@@ -1,3 +1,4 @@
+//  { dg-require-effective-target exceptions_enabled }
 //  { dg-additional-options "-fsyntax-only" }
 
 #if __has_include(<coroutine>)
diff --git a/gcc/testsuite/g++.dg/coroutines/pr95616-5.C b/gcc/testsuite/g++.dg/coroutines/pr95616-5.C
index 930c1a7e6a1..f7602bc593a 100644
--- a/gcc/testsuite/g++.dg/coroutines/pr95616-5.C
+++ b/gcc/testsuite/g++.dg/coroutines/pr95616-5.C
@@ -1,3 +1,4 @@
+//  { dg-require-effective-target exceptions_enabled }
 //  { dg-additional-options "-fsyntax-only" }
 
 #if __has_include(<coroutine>)
diff --git a/gcc/testsuite/g++.dg/coroutines/pr95616-6.C b/gcc/testsuite/g++.dg/coroutines/pr95616-6.C
index e7481711c5e..e535cc9a7d7 100644
--- a/gcc/testsuite/g++.dg/coroutines/pr95616-6.C
+++ b/gcc/testsuite/g++.dg/coroutines/pr95616-6.C
@@ -1,3 +1,4 @@
+//  { dg-require-effective-target exceptions_enabled }
 //  { dg-additional-options "-fsyntax-only" }
 
 #if __has_include(<coroutine>)
diff --git a/gcc/testsuite/g++.dg/cpp0x/catch1.C b/gcc/testsuite/g++.dg/cpp0x/catch1.C
index 81778ea7807..18ff3679a58 100644
--- a/gcc/testsuite/g++.dg/cpp0x/catch1.C
+++ b/gcc/testsuite/g++.dg/cpp0x/catch1.C
@@ -1,5 +1,6 @@
 // PR c++/53371
 // { dg-do compile { target c++11 } }
+// { dg-require-effective-target exceptions_enabled }
 
 struct Abs
 {
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-throw.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-throw.C
index 5666629acae..640f798a154 100644
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-throw.C
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-throw.C
@@ -1,4 +1,5 @@
 // { dg-do compile { target c++11 } }
+// { dg-require-effective-target exceptions_enabled }
 
 constexpr int may_throw(bool decide) {
 	return decide ? 42 : throw -1; // { dg-error "throw" }
diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-89785-2.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-89785-2.C
index 7afd9d24e98..c7fdf678aaf 100644
--- a/gcc/testsuite/g++.dg/cpp1y/constexpr-89785-2.C
+++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-89785-2.C
@@ -1,5 +1,6 @@
 // PR c++/89785
 // { dg-do compile { target c++14 } }
+// { dg-require-effective-target exceptions_enabled }
 
 constexpr int
 foo (int x)
diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-throw.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-throw.C
index 35928744686..305a87b9a78 100644
--- a/gcc/testsuite/g++.dg/cpp1y/constexpr-throw.C
+++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-throw.C
@@ -1,4 +1,5 @@
 // { dg-do compile { target c++14 } }
+// { dg-require-effective-target exceptions_enabled }
 
 constexpr void f1() {
   if (false)
diff --git a/gcc/testsuite/g++.dg/cpp1y/pr79393-3.C b/gcc/testsuite/g++.dg/cpp1y/pr79393-3.C
index 3c73cbbb659..8568d03856d 100644
--- a/gcc/testsuite/g++.dg/cpp1y/pr79393-3.C
+++ b/gcc/testsuite/g++.dg/cpp1y/pr79393-3.C
@@ -1,5 +1,6 @@
 // pr c++/79393
 // { dg-do compile { target c++14 } }
+// { dg-require-effective-target exceptions_enabled }
 
 struct A 
 {
diff --git a/gcc/testsuite/g++.dg/cpp2a/consteval-memfn1.C b/gcc/testsuite/g++.dg/cpp2a/consteval-memfn1.C
index 910e7a1ac1e..757ebac753c 100644
--- a/gcc/testsuite/g++.dg/cpp2a/consteval-memfn1.C
+++ b/gcc/testsuite/g++.dg/cpp2a/consteval-memfn1.C
@@ -1,5 +1,6 @@
 // PR c++/99895
 // { dg-do compile { target c++20 } }
+// { dg-require-effective-target exceptions_enabled }
 
 struct fixed_string {
   consteval int size(int n) const {
diff --git a/gcc/testsuite/g++.dg/cpp2a/consteval11.C b/gcc/testsuite/g++.dg/cpp2a/consteval11.C
index 2f68ec0f892..40694cef4ba 100644
--- a/gcc/testsuite/g++.dg/cpp2a/consteval11.C
+++ b/gcc/testsuite/g++.dg/cpp2a/consteval11.C
@@ -1,4 +1,5 @@
 // { dg-do compile }
+// { dg-require-effective-target exceptions_enabled }
 // { dg-options "-std=c++2a" }
 
 consteval int bar (int i) { if (i != 1) throw 1; return 0; }	// { dg-error "is not a constant expression" }
diff --git a/gcc/testsuite/g++.dg/cpp2a/consteval9.C b/gcc/testsuite/g++.dg/cpp2a/consteval9.C
index 489286a12d2..36ab3d7ee84 100644
--- a/gcc/testsuite/g++.dg/cpp2a/consteval9.C
+++ b/gcc/testsuite/g++.dg/cpp2a/consteval9.C
@@ -1,4 +1,5 @@
 // { dg-do compile }
+// { dg-require-effective-target exceptions_enabled }
 // { dg-options "-std=c++2a" }
 
 consteval int bar (int i) { if (i != 1) throw 1; return 0; }	// { dg-error "is not a constant expression" }
diff --git a/gcc/testsuite/g++.dg/cpp2a/explicit1.C b/gcc/testsuite/g++.dg/cpp2a/explicit1.C
index b39f90f3397..d7e1f3fb1db 100644
--- a/gcc/testsuite/g++.dg/cpp2a/explicit1.C
+++ b/gcc/testsuite/g++.dg/cpp2a/explicit1.C
@@ -1,5 +1,6 @@
 // P0892R2
 // { dg-do compile }
+// { dg-require-effective-target exceptions_enabled }
 // { dg-options "-std=c++2a" }
 
 constexpr int fn0 () { return 0; }
diff --git a/gcc/testsuite/g++.dg/cpp2a/explicit2.C b/gcc/testsuite/g++.dg/cpp2a/explicit2.C
index 7d1748c0f5e..d0f001af177 100644
--- a/gcc/testsuite/g++.dg/cpp2a/explicit2.C
+++ b/gcc/testsuite/g++.dg/cpp2a/explicit2.C
@@ -1,5 +1,6 @@
 // P0892R2
 // { dg-do compile }
+// { dg-require-effective-target exceptions_enabled }
 // { dg-options "-std=c++2a" }
 
 int foo() { return 42; }
diff --git a/gcc/testsuite/g++.dg/cpp2a/explicit5.C b/gcc/testsuite/g++.dg/cpp2a/explicit5.C
index 70a106f1fcb..ae4c7cab2ea 100644
--- a/gcc/testsuite/g++.dg/cpp2a/explicit5.C
+++ b/gcc/testsuite/g++.dg/cpp2a/explicit5.C
@@ -1,5 +1,6 @@
 // P0892R2
 // { dg-do compile }
+// { dg-require-effective-target exceptions_enabled }
 // { dg-options "-std=c++2a" }
 
 constexpr int fn0 () { return 0; }
diff --git a/gcc/testsuite/g++.dg/eh/builtin10.C b/gcc/testsuite/g++.dg/eh/builtin10.C
index 6c34f1f6d5c..f09291aebda 100644
--- a/gcc/testsuite/g++.dg/eh/builtin10.C
+++ b/gcc/testsuite/g++.dg/eh/builtin10.C
@@ -1,5 +1,6 @@
 // PR c++/88482
 // { dg-do compile }
+// { dg-require-effective-target exceptions_enabled }
 
 extern "C" void __cxa_throw (void *, void *, void (*) (void *));
 extern "C" float __cxa_get_exception_ptr (void *) throw ();	// { dg-message "previous declaration" }
diff --git a/gcc/testsuite/g++.dg/eh/builtin11.C b/gcc/testsuite/g++.dg/eh/builtin11.C
index abc8c1af535..04376d3c36a 100644
--- a/gcc/testsuite/g++.dg/eh/builtin11.C
+++ b/gcc/testsuite/g++.dg/eh/builtin11.C
@@ -1,5 +1,6 @@
 // PR c++/88482
 // { dg-do compile }
+// { dg-require-effective-target exceptions_enabled }
 
 extern "C" void __cxa_throw (float, void *, void (*) (void *));	// { dg-message "previous declaration" }
 extern "C" void *__cxa_get_exception_ptr (void *) throw ();
diff --git a/gcc/testsuite/g++.dg/eh/builtin6.C b/gcc/testsuite/g++.dg/eh/builtin6.C
index c05abdc8f51..3cc56510e0e 100644
--- a/gcc/testsuite/g++.dg/eh/builtin6.C
+++ b/gcc/testsuite/g++.dg/eh/builtin6.C
@@ -1,5 +1,6 @@
 // PR c++/88482
 // { dg-do compile }
+// { dg-require-effective-target exceptions_enabled }
 
 float __cxa_throw;		// { dg-message "previous declaration" }
 extern "C" void *__cxa_get_exception_ptr (void *);
diff --git a/gcc/testsuite/g++.dg/eh/builtin7.C b/gcc/testsuite/g++.dg/eh/builtin7.C
index 0ef279d09c1..5c79e2a2261 100644
--- a/gcc/testsuite/g++.dg/eh/builtin7.C
+++ b/gcc/testsuite/g++.dg/eh/builtin7.C
@@ -1,5 +1,6 @@
 // PR c++/88482
 // { dg-do compile }
+// { dg-require-effective-target exceptions_enabled }
 
 extern "C" void __cxa_throw (void *, void *, void (*) (void *));
 int __cxa_get_exception_ptr;		// { dg-message "previous declaration" }
diff --git a/gcc/testsuite/g++.dg/eh/builtin9.C b/gcc/testsuite/g++.dg/eh/builtin9.C
index 591a622630c..4e6ad073cbf 100644
--- a/gcc/testsuite/g++.dg/eh/builtin9.C
+++ b/gcc/testsuite/g++.dg/eh/builtin9.C
@@ -1,5 +1,6 @@
 // PR c++/88482
 // { dg-do compile }
+// { dg-require-effective-target exceptions_enabled }
 
 extern "C" int __cxa_throw (void *, void *, void (*) (void *));	// { dg-message "previous declaration" }
 extern "C" void *__cxa_get_exception_ptr (void *) throw ();
diff --git a/gcc/testsuite/g++.dg/eh/dtor4.C b/gcc/testsuite/g++.dg/eh/dtor4.C
index 6c0e804fe8a..0086121e45a 100644
--- a/gcc/testsuite/g++.dg/eh/dtor4.C
+++ b/gcc/testsuite/g++.dg/eh/dtor4.C
@@ -1,5 +1,7 @@
 // PR c++/109172
 
+// { dg-require-effective-target exceptions_enabled }
+
 class Demo
 {
   ~Demo();
diff --git a/gcc/testsuite/g++.dg/eh/pr42859.C b/gcc/testsuite/g++.dg/eh/pr42859.C
index 0de91409c83..8d3f429c628 100644
--- a/gcc/testsuite/g++.dg/eh/pr42859.C
+++ b/gcc/testsuite/g++.dg/eh/pr42859.C
@@ -1,4 +1,5 @@
 // { dg-do compile }
+// { dg-require-effective-target exceptions_enabled }
 
 void start (void);
 void
diff --git a/gcc/testsuite/g++.dg/ext/stmtexpr25.C b/gcc/testsuite/g++.dg/ext/stmtexpr25.C
index 79c40fc61c4..856f7d29e59 100644
--- a/gcc/testsuite/g++.dg/ext/stmtexpr25.C
+++ b/gcc/testsuite/g++.dg/ext/stmtexpr25.C
@@ -1,6 +1,7 @@
 // PR c++/81073
 // { dg-options "" }
 // { dg-do compile { target c++11 } }
+// { dg-require-effective-target exceptions_enabled }
 
 struct test { const int *addr; };
 
diff --git a/gcc/testsuite/g++.dg/ext/vla4.C b/gcc/testsuite/g++.dg/ext/vla4.C
index e96f2735f8a..c2339359c4f 100644
--- a/gcc/testsuite/g++.dg/ext/vla4.C
+++ b/gcc/testsuite/g++.dg/ext/vla4.C
@@ -1,4 +1,5 @@
 // PR c++/29318
+// { dg-require-effective-target exceptions_enabled }
 // { dg-options "" }
 
 #include <typeinfo>
diff --git a/gcc/testsuite/g++.dg/init/placement4.C b/gcc/testsuite/g++.dg/init/placement4.C
index 3cfe27d63e6..912fc1d03f8 100644
--- a/gcc/testsuite/g++.dg/init/placement4.C
+++ b/gcc/testsuite/g++.dg/init/placement4.C
@@ -1,5 +1,7 @@
 // PR c++/34158
 
+// { dg-require-effective-target exceptions_enabled }
+
 typedef __SIZE_TYPE__ size_t;
 extern "C" void* malloc (size_t);
 extern "C" void free (void *);
diff --git a/gcc/testsuite/g++.dg/other/error32.C b/gcc/testsuite/g++.dg/other/error32.C
index 56d3b7aec8b..19a5a00a2e9 100644
--- a/gcc/testsuite/g++.dg/other/error32.C
+++ b/gcc/testsuite/g++.dg/other/error32.C
@@ -1,4 +1,5 @@
 // PR c++/33492
+// { dg-require-effective-target exceptions_enabled }
 // { dg-options "" }
 
 void foo()
diff --git a/gcc/testsuite/g++.dg/parse/crash55.C b/gcc/testsuite/g++.dg/parse/crash55.C
index 2e88c476fc7..30f7a50f9fa 100644
--- a/gcc/testsuite/g++.dg/parse/crash55.C
+++ b/gcc/testsuite/g++.dg/parse/crash55.C
@@ -1,5 +1,7 @@
 // PR c++/42038
 
+// { dg-require-effective-target exceptions_enabled }
+
 extern int __cxa_begin_catch;	// { dg-message "previous declaration" }
 
 void f(void)
diff --git a/gcc/testsuite/g++.dg/parse/pr31952-2.C b/gcc/testsuite/g++.dg/parse/pr31952-2.C
index f09bcab1b85..968aabc385c 100644
--- a/gcc/testsuite/g++.dg/parse/pr31952-2.C
+++ b/gcc/testsuite/g++.dg/parse/pr31952-2.C
@@ -1,5 +1,7 @@
 // PR c++/31952
 
+// { dg-require-effective-target exceptions_enabled }
+
 void
 f0()
 {
diff --git a/gcc/testsuite/g++.dg/parse/pr31952-3.C b/gcc/testsuite/g++.dg/parse/pr31952-3.C
index 9fe5f028378..92539a39a95 100644
--- a/gcc/testsuite/g++.dg/parse/pr31952-3.C
+++ b/gcc/testsuite/g++.dg/parse/pr31952-3.C
@@ -1,5 +1,7 @@
 // PR c++/31952
 
+// { dg-require-effective-target exceptions_enabled }
+
 int
 f0 (int bar)     // { dg-message "previously" }
 try
diff --git a/gcc/testsuite/g++.dg/tm/noexcept-7.C b/gcc/testsuite/g++.dg/tm/noexcept-7.C
index bfa675c987f..c3734e86c66 100644
--- a/gcc/testsuite/g++.dg/tm/noexcept-7.C
+++ b/gcc/testsuite/g++.dg/tm/noexcept-7.C
@@ -1,4 +1,5 @@
 // FIXME the TS says atomic_noexcept calls abort, not terminate.
+// { dg-require-effective-target exceptions_enabled }
 // { dg-options "-fgnu-tm" }
 
 void f()
diff --git a/gcc/testsuite/g++.dg/torture/pr43257.C b/gcc/testsuite/g++.dg/torture/pr43257.C
index fab5f09c31a..633b7ec3465 100644
--- a/gcc/testsuite/g++.dg/torture/pr43257.C
+++ b/gcc/testsuite/g++.dg/torture/pr43257.C
@@ -1,4 +1,5 @@
 /* { dg-do assemble } */
+/* { dg-require-effective-target exceptions_enabled } */
 
 class A {};
 class B {};
diff --git a/gcc/testsuite/g++.dg/torture/pr56694.C b/gcc/testsuite/g++.dg/torture/pr56694.C
index 774bac4c615..dfaaf31c192 100644
--- a/gcc/testsuite/g++.dg/torture/pr56694.C
+++ b/gcc/testsuite/g++.dg/torture/pr56694.C
@@ -1,4 +1,5 @@
 // { dg-do compile }
+// { dg-require-effective-target exceptions_enabled }
 // { dg-options "-fopenmp" }
 // { dg-require-effective-target fopenmp }
 
diff --git a/gcc/testsuite/g++.dg/torture/pr81659.C b/gcc/testsuite/g++.dg/torture/pr81659.C
index 074099be6fc..e78483f88fe 100644
--- a/gcc/testsuite/g++.dg/torture/pr81659.C
+++ b/gcc/testsuite/g++.dg/torture/pr81659.C
@@ -1,4 +1,5 @@
 // { dg-do compile }
+// { dg-require-effective-target exceptions_enabled }
 
 void
 a (int b)
diff --git a/gcc/testsuite/g++.dg/warn/Wcatch-value-1.C b/gcc/testsuite/g++.dg/warn/Wcatch-value-1.C
index a84b337b939..9616024e0e9 100644
--- a/gcc/testsuite/g++.dg/warn/Wcatch-value-1.C
+++ b/gcc/testsuite/g++.dg/warn/Wcatch-value-1.C
@@ -1,3 +1,4 @@
+// { dg-require-effective-target exceptions_enabled }
 // { dg-options "-Wcatch-value=1" }
 
 struct A { virtual ~A() {} };
diff --git a/gcc/testsuite/g++.dg/warn/Wcatch-value-2.C b/gcc/testsuite/g++.dg/warn/Wcatch-value-2.C
index e20719c155b..43f3e00472d 100644
--- a/gcc/testsuite/g++.dg/warn/Wcatch-value-2.C
+++ b/gcc/testsuite/g++.dg/warn/Wcatch-value-2.C
@@ -1,3 +1,4 @@
+// { dg-require-effective-target exceptions_enabled }
 // { dg-options "-Wcatch-value=2" }
 
 struct A { virtual ~A() {} };
diff --git a/gcc/testsuite/g++.dg/warn/Wcatch-value-3.C b/gcc/testsuite/g++.dg/warn/Wcatch-value-3.C
index c91a3c08590..b48c989503d 100644
--- a/gcc/testsuite/g++.dg/warn/Wcatch-value-3.C
+++ b/gcc/testsuite/g++.dg/warn/Wcatch-value-3.C
@@ -1,3 +1,4 @@
+// { dg-require-effective-target exceptions_enabled }
 // { dg-options "-Wcatch-value=3" }
 
 struct A { virtual ~A() {} };
diff --git a/gcc/testsuite/g++.dg/warn/Wcatch-value-3b.C b/gcc/testsuite/g++.dg/warn/Wcatch-value-3b.C
index cb9af4a6019..47ea4671ac1 100644
--- a/gcc/testsuite/g++.dg/warn/Wcatch-value-3b.C
+++ b/gcc/testsuite/g++.dg/warn/Wcatch-value-3b.C
@@ -1,3 +1,4 @@
+// { dg-require-effective-target exceptions_enabled }
 // { dg-options "-Wcatch-value=3" }
 
 struct A { virtual ~A() {} };
diff --git a/gcc/testsuite/g++.dg/warn/Wexceptions1.C b/gcc/testsuite/g++.dg/warn/Wexceptions1.C
index af140fd0dc2..dd4c3252d39 100644
--- a/gcc/testsuite/g++.dg/warn/Wexceptions1.C
+++ b/gcc/testsuite/g++.dg/warn/Wexceptions1.C
@@ -1,5 +1,7 @@
 // PR c++/97675
 
+// { dg-require-effective-target exceptions_enabled }
+
 struct Base { };
 struct Child : Base { };
 int main() {
diff --git a/gcc/testsuite/g++.dg/warn/Wexceptions3.C b/gcc/testsuite/g++.dg/warn/Wexceptions3.C
index 97fda9dbd91..cd041ae248c 100644
--- a/gcc/testsuite/g++.dg/warn/Wexceptions3.C
+++ b/gcc/testsuite/g++.dg/warn/Wexceptions3.C
@@ -1,5 +1,7 @@
 // PR c++/81660
 
+// { dg-require-effective-target exceptions_enabled }
+
 void bar (int);
 
 void
diff --git a/gcc/testsuite/g++.dg/warn/Winfinite-recursion-3.C b/gcc/testsuite/g++.dg/warn/Winfinite-recursion-3.C
index 166e6d5790d..d4d76fba19f 100644
--- a/gcc/testsuite/g++.dg/warn/Winfinite-recursion-3.C
+++ b/gcc/testsuite/g++.dg/warn/Winfinite-recursion-3.C
@@ -1,5 +1,6 @@
 /* PR middle-end/88232 - Please implement -Winfinite-recursion
    { dg-do compile }
+   { dg-require-effective-target exceptions_enabled }
    { dg-options "-Wall -Winfinite-recursion" } */
 
 typedef __SIZE_TYPE__ size_t;
diff --git a/gcc/testsuite/g++.dg/warn/Wreturn-6.C b/gcc/testsuite/g++.dg/warn/Wreturn-6.C
index 85fef0e16df..85a1f696f20 100644
--- a/gcc/testsuite/g++.dg/warn/Wreturn-6.C
+++ b/gcc/testsuite/g++.dg/warn/Wreturn-6.C
@@ -1,5 +1,7 @@
 // PR c++/107310
 
+// { dg-require-effective-target exceptions_enabled }
+
 struct f
 {
   ~f();
diff --git a/gcc/testsuite/g++.dg/warn/Wstringop-truncation-2.C b/gcc/testsuite/g++.dg/warn/Wstringop-truncation-2.C
index ebbd44307d9..f9062f7621b 100644
--- a/gcc/testsuite/g++.dg/warn/Wstringop-truncation-2.C
+++ b/gcc/testsuite/g++.dg/warn/Wstringop-truncation-2.C
@@ -3,6 +3,7 @@
 // Compile with -g to verify the warning deals properly with debug
 // statements.
 // { dg-do compile }
+// { dg-require-effective-target exceptions_enabled }
 // { dg-options "-O2 -Wstringop-truncation -g" }
 
 extern "C" char* strncpy (char*, const char*, __SIZE_TYPE__);
diff --git a/gcc/testsuite/g++.dg/warn/Wterminate1.C b/gcc/testsuite/g++.dg/warn/Wterminate1.C
index affb48d3e8a..246555ca039 100644
--- a/gcc/testsuite/g++.dg/warn/Wterminate1.C
+++ b/gcc/testsuite/g++.dg/warn/Wterminate1.C
@@ -1,6 +1,7 @@
 // In C++98 mode this gets a -Wc++11-compat warning, in C++11 mode a
 // -Wterminate warning.
 
+// { dg-require-effective-target exceptions_enabled }
 // { dg-options "-Wall" }
 
 struct A
diff --git a/gcc/testsuite/g++.old-deja/g++.eh/catch1.C b/gcc/testsuite/g++.old-deja/g++.eh/catch1.C
index 67779d945ea..68e2c745655 100644
--- a/gcc/testsuite/g++.old-deja/g++.eh/catch1.C
+++ b/gcc/testsuite/g++.old-deja/g++.eh/catch1.C
@@ -1,4 +1,5 @@
 // { dg-do assemble  }
+// { dg-require-effective-target exceptions_enabled }
 // 
 // Copyright (C) 1999 Free Software Foundation, Inc.
 // Contributed by Nathan Sidwell 6 Jun 1999 <nathan@acm.org>
diff --git a/gcc/testsuite/g++.old-deja/g++.eh/catch10.C b/gcc/testsuite/g++.old-deja/g++.eh/catch10.C
index 7cc609645a2..c085c9b39e0 100644
--- a/gcc/testsuite/g++.old-deja/g++.eh/catch10.C
+++ b/gcc/testsuite/g++.old-deja/g++.eh/catch10.C
@@ -1,4 +1,5 @@
 // { dg-do assemble  }
+// { dg-require-effective-target exceptions_enabled }
 // Test that we notice unfortunate handler ordering.
 
 struct A { };
diff --git a/gcc/testsuite/g++.old-deja/g++.eh/cond1.C b/gcc/testsuite/g++.old-deja/g++.eh/cond1.C
index fe6d4296ab5..a7fcf890099 100644
--- a/gcc/testsuite/g++.old-deja/g++.eh/cond1.C
+++ b/gcc/testsuite/g++.old-deja/g++.eh/cond1.C
@@ -1,4 +1,5 @@
 // { dg-do assemble  }
+// { dg-require-effective-target exceptions_enabled }
 
 // Copyright (C) 1999, 2000 Free Software Foundation, Inc.
 // Contributed by Nathan Sidwell 11 Apr 1999 <nathan@acm.org>
diff --git a/gcc/testsuite/g++.old-deja/g++.eh/ctor1.C b/gcc/testsuite/g++.old-deja/g++.eh/ctor1.C
index cc39ac3953f..b3b0ce2d00c 100644
--- a/gcc/testsuite/g++.old-deja/g++.eh/ctor1.C
+++ b/gcc/testsuite/g++.old-deja/g++.eh/ctor1.C
@@ -1,4 +1,6 @@
 // { dg-do assemble  }
+// { dg-require-effective-target exceptions_enabled }
+
 struct A
 {
   A();
diff --git a/gcc/testsuite/g++.old-deja/g++.eh/throw2.C b/gcc/testsuite/g++.old-deja/g++.eh/throw2.C
index 957c200f8af..b7acb6206b2 100644
--- a/gcc/testsuite/g++.old-deja/g++.eh/throw2.C
+++ b/gcc/testsuite/g++.old-deja/g++.eh/throw2.C
@@ -1,4 +1,5 @@
 // { dg-do assemble  }
+// { dg-require-effective-target exceptions_enabled }
 
 // Submitted by Sebastian Ritterbusch <uabp@rz.uni-karlsruhe.de>
 
diff --git a/gcc/testsuite/g++.old-deja/g++.other/cond5.C b/gcc/testsuite/g++.old-deja/g++.other/cond5.C
index 0d2baf9edf7..9474c35f252 100644
--- a/gcc/testsuite/g++.old-deja/g++.other/cond5.C
+++ b/gcc/testsuite/g++.old-deja/g++.other/cond5.C
@@ -1,4 +1,5 @@
 // { dg-do assemble  }
+// { dg-require-effective-target exceptions_enabled }
 // { dg-options "-W -pedantic -ansi" }
 
 // Copyright (C) 1999, 2000 Free Software Foundation, Inc.
-- 
2.34.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Skip a number of C++ test cases for '-fno-exceptions' testing (was: Support in the GCC(/C++) test suites for '-fno-exceptions')
  2023-09-08 13:30     ` Skip a number of C++ test cases for '-fno-exceptions' testing (was: Support in the GCC(/C++) test suites for '-fno-exceptions') Thomas Schwinge
@ 2023-11-03 11:03       ` Thomas Schwinge
  2023-11-03 11:15         ` Jakub Jelinek
  0 siblings, 1 reply; 14+ messages in thread
From: Thomas Schwinge @ 2023-11-03 11:03 UTC (permalink / raw)
  To: Jason Merrill, gcc-patches; +Cc: libstdc++, Jonathan Wakely, Nathan Sidwell

[-- Attachment #1: Type: text/plain, Size: 5665 bytes --]

Hi!

On 2023-09-08T15:30:50+0200, I wrote:
> GCC/C++ front end maintainers, please provide input on the overall
> approach here:

Jason verbally ACKed this at the GNU Tools Cauldron 2023.

> On 2023-06-15T17:15:54+0200, I wrote:
>> On 2023-06-06T20:31:21+0100, Jonathan Wakely <jwakely@redhat.com> wrote:
>>> On Tue, 6 Jun 2023 at 20:14, Thomas Schwinge <thomas@codesourcery.com> wrote:
>>>> This issue comes up in context of me working on C++ support for GCN and
>>>> nvptx target.  Those targets shall default to '-fno-exceptions' -- or,
>>>> "in other words", '-fexceptions' is not supported.  (Details omitted
>>>> here.)
>>>>
>>>> It did seem clear to me that with such a configuration it'll be hard to
>>>> get clean test results.  Then I found code in
>>>> 'gcc/testsuite/lib/gcc-dg.exp:gcc-dg-prune':
>>>>
>>>>     # If exceptions are disabled, mark tests expecting exceptions to be enabled
>>>>     # as unsupported.
>>>>     if { ![check_effective_target_exceptions_enabled] } {
>>>>         if [regexp "(^|\n)\[^\n\]*: error: exception handling disabled" $text] {
>>>>             return "::unsupported::exception handling disabled"
>>>>         }
>>>>
>>>> ..., which, in a way, sounds as if the test suite generally is meant to
>>>> produce useful results for '-fno-exceptions', nice surprise!
>>>>
>>>> Running x86_64-pc-linux-gnu (not yet GCN, nvptx) 'make check' with:
>>>>
>>>>     RUNTESTFLAGS='--target_board=unix/-fno-exceptions\{,-m32\}'
>>>>
>>>> ..., I find that indeed this does work for a lot of test cases, where we
>>>> then get (random example):
>>>>
>>>>      PASS: g++.dg/coroutines/pr99710.C  (test for errors, line 23)
>>>>     -PASS: g++.dg/coroutines/pr99710.C (test for excess errors)
>>>>     +UNSUPPORTED: g++.dg/coroutines/pr99710.C: exception handling disabled
>>>>
>>>> ..., due to:
>>>>
>>>>      [...]/g++.dg/coroutines/pr99710.C: In function 'task my_coro()':
>>>>     +[...]/g++.dg/coroutines/pr99710.C:18:10: error: exception handling disabled, use '-fexceptions' to enable
>>>>      [...]/g++.dg/coroutines/pr99710.C:23:7: error: await expressions are not permitted in handlers
>>>>      compiler exited with status 1
>>>>
>>>> But, we're nowhere near clean test results: PASS -> FAIL as well as
>>>> XFAIL -> XPASS regressions, due to 'error: exception handling disabled'
>>>> precluding other diagnostics seems to be one major issue.
>>>>
>>>> Is there interest in me producing the obvious (?) changes to those test
>>>> cases, such that compiler g++ as well as target library libstdc++ test
>>>> results are reasonably clean?  (If you think that's all "wasted effort",
>>>> then I suppose I'll just locally ignore any FAILs/XPASSes/UNRESOLVEDs
>>>> that appear in combination with
>>>> 'UNSUPPORTED: [...]: exception handling disabled'.)
>>>
>>> I would welcome that for libstdc++. [...]
>
>> Per your and my changes a few days ago, we've already got libstdc++
>> covered, [...]
>
>> Not having heard anything contrary regarding the compiler side of things,
>> I've now been working on that, see below.
>>
>>> We already have a handful of tests that use #if __cpp_exceptions to make
>>> those parts conditional on exception support.
>>
>> Yes, that's an option not for all but certainly for some test cases.
>> (I'm not looking into that now -- but this may in fact be a good
>> beginner-level task, will add to <https://gcc.gnu.org/wiki/EasyHacks>).

Done: <https://gcc.gnu.org/wiki/EasyHacks#fno-exceptions>
"Improve test suite coverage for '-fno-exceptions' configurations".

>>>> Otherwise, a number of test cases need DejaGnu directives
>>>> conditionalized on 'target exceptions_enabled'.
>>
>> Before I get to such things, even simpler: OK to push the attached
>> "Skip a number of C++ test cases for '-fno-exceptions' testing"?
>
> I've re-attached my patch from a few months ago:
> "Skip a number of C++ test cases for '-fno-exceptions' testing".
> (I'd obviously re-check for current master branch before 'git push'.)

Pushed to master branch commit fe65f4a2a39b389a4240dc59d856b082c0b5ad96
"Skip a number of C++ test cases for '-fno-exceptions' testing", see
attached.


Grüße
 Thomas


> If there is interest in this at all, I'd then later complete and submit
> my more or less WIP patches for the slightly more involved test case
> scenarios.
>
>
> Grüße
>  Thomas
>
>
>>>> (Or,
>>>> 'error: exception handling disabled' made a "really late" diagnostic, so
>>>> that it doesn't preclude other diagnostics?  I'll have a look.  Well,
>>>> maybe something like: in fact do not default to '-fno-exceptions', but
>>>> instead emit 'error: exception handling disabled' only if in a "really
>>>> late" pass we run into exceptions-related constructs that we cannot
>>>> support.  That'd also avoid PASS -> UNSUPPORTED "regressions" when
>>>> exception handling in fact gets optimized away, for example.  I like that
>>>> idea, conceptually -- but is it feasible to implement..?)
>>>
>>> IMHO just [...] using [an effective target keyword] in test
>>> selectors seems simpler, and doesn't require changes to the compiler, just
>>> the tests.
>>
>> I still like the idea, but yes, I've mentally put it on file "for later"
>> (ha, ha, ha...) -- it doesn't seem obvious to implement.
>>
>>
>> Grüße
>>  Thomas


-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Skip-a-number-of-C-test-cases-for-fno-exceptions-tes.patch --]
[-- Type: text/x-diff, Size: 28280 bytes --]

From fe65f4a2a39b389a4240dc59d856b082c0b5ad96 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Wed, 7 Jun 2023 14:14:44 +0200
Subject: [PATCH] Skip a number of C++ test cases for '-fno-exceptions' testing

Running 'make check' with: 'RUNTESTFLAGS=--target_board=unix/-fno-exceptions',
'error: exception handling disabled' is triggered for C++ 'throw' etc. usage,
and per 'gcc/testsuite/lib/gcc-dg.exp:gcc-dg-prune':

    # If exceptions are disabled, mark tests expecting exceptions to be enabled
    # as unsupported.
    if { ![check_effective_target_exceptions_enabled] } {
	if [regexp "(^|\n)\[^\n\]*: error: exception handling disabled" $text] {
	    return "::unsupported::exception handling disabled"
	}

..., which generally means:

    -PASS: [...] (test for excess errors)
    +UNSUPPORTED: [...]: exception handling disabled

However, if there are additional 'dg-error' etc. directives, these may regress
PASS -> FAIL (or similar) -- if their associated diagnostics are precluded by
'error: exception handling disabled'.  For example:

    PASS: g++.dg/cpp2a/explicit1.C    (test for errors, line 43)
    PASS: g++.dg/cpp2a/explicit1.C    (test for errors, line 47)
    [-PASS:-]{+FAIL:+} g++.dg/cpp2a/explicit1.C    (test for errors, line 50)
    [-PASS:-]{+FAIL:+} g++.dg/cpp2a/explicit1.C    (test for errors, line 51)
    PASS: g++.dg/cpp2a/explicit1.C    (test for errors, line 52)
    PASS: g++.dg/cpp2a/explicit1.C    (test for errors, line 53)
    PASS: g++.dg/cpp2a/explicit1.C    (test for errors, line 59)
    [-PASS:-]{+UNSUPPORTED:+} g++.dg/cpp2a/explicit1.C  [-(test for excess errors)-]{+: exception handling disabled+}

Specify 'dg-require-effective-target exceptions_enabled' for those test cases.

	gcc/testsuite/
	* g++.dg/cpp0x/catch1.C: Specify
	'dg-require-effective-target exceptions_enabled'.
	* g++.dg/cpp0x/constexpr-throw.C: Likewise.
	* g++.dg/cpp1y/constexpr-89785-2.C: Likewise.
	* g++.dg/cpp1y/constexpr-throw.C: Likewise.
	* g++.dg/cpp1y/pr79393-3.C: Likewise.
	* g++.dg/cpp2a/consteval-memfn1.C: Likewise.
	* g++.dg/cpp2a/consteval11.C: Likewise.
	* g++.dg/cpp2a/consteval34.C: Likewise.
	* g++.dg/cpp2a/consteval9.C: Likewise.
	* g++.dg/cpp2a/explicit1.C: Likewise.
	* g++.dg/cpp2a/explicit2.C: Likewise.
	* g++.dg/cpp2a/explicit5.C: Likewise.
	* g++.dg/eh/builtin10.C: Likewise.
	* g++.dg/eh/builtin11.C: Likewise.
	* g++.dg/eh/builtin6.C: Likewise.
	* g++.dg/eh/builtin7.C: Likewise.
	* g++.dg/eh/builtin9.C: Likewise.
	* g++.dg/eh/dtor4.C: Likewise.
	* g++.dg/eh/pr42859.C: Likewise.
	* g++.dg/ext/stmtexpr25.C: Likewise.
	* g++.dg/ext/vla4.C: Likewise.
	* g++.dg/init/placement4.C: Likewise.
	* g++.dg/other/error32.C: Likewise.
	* g++.dg/parse/crash55.C: Likewise.
	* g++.dg/parse/pr31952-2.C: Likewise.
	* g++.dg/parse/pr31952-3.C: Likewise.
	* g++.dg/tm/noexcept-7.C: Likewise.
	* g++.dg/torture/pr43257.C: Likewise.
	* g++.dg/torture/pr56694.C: Likewise.
	* g++.dg/torture/pr81659.C: Likewise.
	* g++.dg/warn/Wcatch-value-1.C: Likewise.
	* g++.dg/warn/Wcatch-value-2.C: Likewise.
	* g++.dg/warn/Wcatch-value-3.C: Likewise.
	* g++.dg/warn/Wcatch-value-3b.C: Likewise.
	* g++.dg/warn/Wexceptions1.C: Likewise.
	* g++.dg/warn/Wexceptions3.C: Likewise.
	* g++.dg/warn/Winfinite-recursion-3.C: Likewise.
	* g++.dg/warn/Wreturn-6.C: Likewise.
	* g++.dg/warn/Wstringop-truncation-2.C: Likewise.
	* g++.dg/warn/Wterminate1.C: Likewise.
	* g++.old-deja/g++.eh/catch1.C: Likewise.
	* g++.old-deja/g++.eh/catch10.C: Likewise.
	* g++.old-deja/g++.eh/cond1.C: Likewise.
	* g++.old-deja/g++.eh/ctor1.C: Likewise.
	* g++.old-deja/g++.eh/throw2.C: Likewise.
	* g++.old-deja/g++.other/cond5.C: Likewise.
---
 gcc/testsuite/g++.dg/cpp0x/catch1.C                | 1 +
 gcc/testsuite/g++.dg/cpp0x/constexpr-throw.C       | 1 +
 gcc/testsuite/g++.dg/cpp1y/constexpr-89785-2.C     | 1 +
 gcc/testsuite/g++.dg/cpp1y/constexpr-throw.C       | 1 +
 gcc/testsuite/g++.dg/cpp1y/pr79393-3.C             | 1 +
 gcc/testsuite/g++.dg/cpp2a/consteval-memfn1.C      | 1 +
 gcc/testsuite/g++.dg/cpp2a/consteval11.C           | 1 +
 gcc/testsuite/g++.dg/cpp2a/consteval34.C           | 1 +
 gcc/testsuite/g++.dg/cpp2a/consteval9.C            | 1 +
 gcc/testsuite/g++.dg/cpp2a/explicit1.C             | 1 +
 gcc/testsuite/g++.dg/cpp2a/explicit2.C             | 1 +
 gcc/testsuite/g++.dg/cpp2a/explicit5.C             | 1 +
 gcc/testsuite/g++.dg/eh/builtin10.C                | 1 +
 gcc/testsuite/g++.dg/eh/builtin11.C                | 1 +
 gcc/testsuite/g++.dg/eh/builtin6.C                 | 1 +
 gcc/testsuite/g++.dg/eh/builtin7.C                 | 1 +
 gcc/testsuite/g++.dg/eh/builtin9.C                 | 1 +
 gcc/testsuite/g++.dg/eh/dtor4.C                    | 2 ++
 gcc/testsuite/g++.dg/eh/pr42859.C                  | 1 +
 gcc/testsuite/g++.dg/ext/stmtexpr25.C              | 1 +
 gcc/testsuite/g++.dg/ext/vla4.C                    | 1 +
 gcc/testsuite/g++.dg/init/placement4.C             | 2 ++
 gcc/testsuite/g++.dg/other/error32.C               | 1 +
 gcc/testsuite/g++.dg/parse/crash55.C               | 2 ++
 gcc/testsuite/g++.dg/parse/pr31952-2.C             | 2 ++
 gcc/testsuite/g++.dg/parse/pr31952-3.C             | 2 ++
 gcc/testsuite/g++.dg/tm/noexcept-7.C               | 1 +
 gcc/testsuite/g++.dg/torture/pr43257.C             | 1 +
 gcc/testsuite/g++.dg/torture/pr56694.C             | 1 +
 gcc/testsuite/g++.dg/torture/pr81659.C             | 1 +
 gcc/testsuite/g++.dg/warn/Wcatch-value-1.C         | 1 +
 gcc/testsuite/g++.dg/warn/Wcatch-value-2.C         | 1 +
 gcc/testsuite/g++.dg/warn/Wcatch-value-3.C         | 1 +
 gcc/testsuite/g++.dg/warn/Wcatch-value-3b.C        | 1 +
 gcc/testsuite/g++.dg/warn/Wexceptions1.C           | 2 ++
 gcc/testsuite/g++.dg/warn/Wexceptions3.C           | 2 ++
 gcc/testsuite/g++.dg/warn/Winfinite-recursion-3.C  | 1 +
 gcc/testsuite/g++.dg/warn/Wreturn-6.C              | 2 ++
 gcc/testsuite/g++.dg/warn/Wstringop-truncation-2.C | 1 +
 gcc/testsuite/g++.dg/warn/Wterminate1.C            | 1 +
 gcc/testsuite/g++.old-deja/g++.eh/catch1.C         | 1 +
 gcc/testsuite/g++.old-deja/g++.eh/catch10.C        | 1 +
 gcc/testsuite/g++.old-deja/g++.eh/cond1.C          | 1 +
 gcc/testsuite/g++.old-deja/g++.eh/ctor1.C          | 2 ++
 gcc/testsuite/g++.old-deja/g++.eh/throw2.C         | 1 +
 gcc/testsuite/g++.old-deja/g++.other/cond5.C       | 1 +
 46 files changed, 55 insertions(+)

diff --git a/gcc/testsuite/g++.dg/cpp0x/catch1.C b/gcc/testsuite/g++.dg/cpp0x/catch1.C
index 81778ea7807..733bd560180 100644
--- a/gcc/testsuite/g++.dg/cpp0x/catch1.C
+++ b/gcc/testsuite/g++.dg/cpp0x/catch1.C
@@ -1,5 +1,6 @@
 // PR c++/53371
 // { dg-do compile { target c++11 } }
+// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
 
 struct Abs
 {
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-throw.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-throw.C
index 5666629acae..9c49fa4e9e8 100644
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-throw.C
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-throw.C
@@ -1,4 +1,5 @@
 // { dg-do compile { target c++11 } }
+// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
 
 constexpr int may_throw(bool decide) {
 	return decide ? 42 : throw -1; // { dg-error "throw" }
diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-89785-2.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-89785-2.C
index 7afd9d24e98..47c0d4daa60 100644
--- a/gcc/testsuite/g++.dg/cpp1y/constexpr-89785-2.C
+++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-89785-2.C
@@ -1,5 +1,6 @@
 // PR c++/89785
 // { dg-do compile { target c++14 } }
+// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
 
 constexpr int
 foo (int x)
diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-throw.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-throw.C
index 35928744686..b5fa6caeb57 100644
--- a/gcc/testsuite/g++.dg/cpp1y/constexpr-throw.C
+++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-throw.C
@@ -1,4 +1,5 @@
 // { dg-do compile { target c++14 } }
+// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
 
 constexpr void f1() {
   if (false)
diff --git a/gcc/testsuite/g++.dg/cpp1y/pr79393-3.C b/gcc/testsuite/g++.dg/cpp1y/pr79393-3.C
index 3c73cbbb659..6d9b77ae946 100644
--- a/gcc/testsuite/g++.dg/cpp1y/pr79393-3.C
+++ b/gcc/testsuite/g++.dg/cpp1y/pr79393-3.C
@@ -1,5 +1,6 @@
 // pr c++/79393
 // { dg-do compile { target c++14 } }
+// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
 
 struct A 
 {
diff --git a/gcc/testsuite/g++.dg/cpp2a/consteval-memfn1.C b/gcc/testsuite/g++.dg/cpp2a/consteval-memfn1.C
index 63f4f1d526a..46eed13446d 100644
--- a/gcc/testsuite/g++.dg/cpp2a/consteval-memfn1.C
+++ b/gcc/testsuite/g++.dg/cpp2a/consteval-memfn1.C
@@ -1,5 +1,6 @@
 // PR c++/99895
 // { dg-do compile { target c++20 } }
+// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
 
 struct fixed_string {
   consteval int size(int n) const {
diff --git a/gcc/testsuite/g++.dg/cpp2a/consteval11.C b/gcc/testsuite/g++.dg/cpp2a/consteval11.C
index 091127eabbf..05cecea4502 100644
--- a/gcc/testsuite/g++.dg/cpp2a/consteval11.C
+++ b/gcc/testsuite/g++.dg/cpp2a/consteval11.C
@@ -1,4 +1,5 @@
 // { dg-do compile }
+// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
 // { dg-options "-std=c++2a" }
 
 consteval int bar (int i) { if (i != 1) throw 1; return 0; }	// { dg-error "is not a constant expression" }
diff --git a/gcc/testsuite/g++.dg/cpp2a/consteval34.C b/gcc/testsuite/g++.dg/cpp2a/consteval34.C
index d5e2d1dc5d2..068827ba516 100644
--- a/gcc/testsuite/g++.dg/cpp2a/consteval34.C
+++ b/gcc/testsuite/g++.dg/cpp2a/consteval34.C
@@ -1,4 +1,5 @@
 // { dg-do compile { target c++20 } }
+// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
 
 consteval int bar (int i) { if (i != 1) throw 1; return 0; }	// { dg-error "is not a constant expression" }
 
diff --git a/gcc/testsuite/g++.dg/cpp2a/consteval9.C b/gcc/testsuite/g++.dg/cpp2a/consteval9.C
index aa75ba37849..051a3d4e355 100644
--- a/gcc/testsuite/g++.dg/cpp2a/consteval9.C
+++ b/gcc/testsuite/g++.dg/cpp2a/consteval9.C
@@ -1,4 +1,5 @@
 // { dg-do compile }
+// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
 // { dg-options "-std=c++2a" }
 
 consteval int bar (int i) { if (i != 1) throw 1; return 0; }	// { dg-error "is not a constant expression" }
diff --git a/gcc/testsuite/g++.dg/cpp2a/explicit1.C b/gcc/testsuite/g++.dg/cpp2a/explicit1.C
index b39f90f3397..290f16c2b7f 100644
--- a/gcc/testsuite/g++.dg/cpp2a/explicit1.C
+++ b/gcc/testsuite/g++.dg/cpp2a/explicit1.C
@@ -1,5 +1,6 @@
 // P0892R2
 // { dg-do compile }
+// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
 // { dg-options "-std=c++2a" }
 
 constexpr int fn0 () { return 0; }
diff --git a/gcc/testsuite/g++.dg/cpp2a/explicit2.C b/gcc/testsuite/g++.dg/cpp2a/explicit2.C
index 7d1748c0f5e..95651436eb7 100644
--- a/gcc/testsuite/g++.dg/cpp2a/explicit2.C
+++ b/gcc/testsuite/g++.dg/cpp2a/explicit2.C
@@ -1,5 +1,6 @@
 // P0892R2
 // { dg-do compile }
+// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
 // { dg-options "-std=c++2a" }
 
 int foo() { return 42; }
diff --git a/gcc/testsuite/g++.dg/cpp2a/explicit5.C b/gcc/testsuite/g++.dg/cpp2a/explicit5.C
index 70a106f1fcb..00d3372bfed 100644
--- a/gcc/testsuite/g++.dg/cpp2a/explicit5.C
+++ b/gcc/testsuite/g++.dg/cpp2a/explicit5.C
@@ -1,5 +1,6 @@
 // P0892R2
 // { dg-do compile }
+// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
 // { dg-options "-std=c++2a" }
 
 constexpr int fn0 () { return 0; }
diff --git a/gcc/testsuite/g++.dg/eh/builtin10.C b/gcc/testsuite/g++.dg/eh/builtin10.C
index 6c34f1f6d5c..6148e65e35a 100644
--- a/gcc/testsuite/g++.dg/eh/builtin10.C
+++ b/gcc/testsuite/g++.dg/eh/builtin10.C
@@ -1,5 +1,6 @@
 // PR c++/88482
 // { dg-do compile }
+// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
 
 extern "C" void __cxa_throw (void *, void *, void (*) (void *));
 extern "C" float __cxa_get_exception_ptr (void *) throw ();	// { dg-message "previous declaration" }
diff --git a/gcc/testsuite/g++.dg/eh/builtin11.C b/gcc/testsuite/g++.dg/eh/builtin11.C
index abc8c1af535..10cf0859b46 100644
--- a/gcc/testsuite/g++.dg/eh/builtin11.C
+++ b/gcc/testsuite/g++.dg/eh/builtin11.C
@@ -1,5 +1,6 @@
 // PR c++/88482
 // { dg-do compile }
+// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
 
 extern "C" void __cxa_throw (float, void *, void (*) (void *));	// { dg-message "previous declaration" }
 extern "C" void *__cxa_get_exception_ptr (void *) throw ();
diff --git a/gcc/testsuite/g++.dg/eh/builtin6.C b/gcc/testsuite/g++.dg/eh/builtin6.C
index c05abdc8f51..b3b52065065 100644
--- a/gcc/testsuite/g++.dg/eh/builtin6.C
+++ b/gcc/testsuite/g++.dg/eh/builtin6.C
@@ -1,5 +1,6 @@
 // PR c++/88482
 // { dg-do compile }
+// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
 
 float __cxa_throw;		// { dg-message "previous declaration" }
 extern "C" void *__cxa_get_exception_ptr (void *);
diff --git a/gcc/testsuite/g++.dg/eh/builtin7.C b/gcc/testsuite/g++.dg/eh/builtin7.C
index 0ef279d09c1..118e145ed38 100644
--- a/gcc/testsuite/g++.dg/eh/builtin7.C
+++ b/gcc/testsuite/g++.dg/eh/builtin7.C
@@ -1,5 +1,6 @@
 // PR c++/88482
 // { dg-do compile }
+// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
 
 extern "C" void __cxa_throw (void *, void *, void (*) (void *));
 int __cxa_get_exception_ptr;		// { dg-message "previous declaration" }
diff --git a/gcc/testsuite/g++.dg/eh/builtin9.C b/gcc/testsuite/g++.dg/eh/builtin9.C
index 591a622630c..a24d248003b 100644
--- a/gcc/testsuite/g++.dg/eh/builtin9.C
+++ b/gcc/testsuite/g++.dg/eh/builtin9.C
@@ -1,5 +1,6 @@
 // PR c++/88482
 // { dg-do compile }
+// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
 
 extern "C" int __cxa_throw (void *, void *, void (*) (void *));	// { dg-message "previous declaration" }
 extern "C" void *__cxa_get_exception_ptr (void *) throw ();
diff --git a/gcc/testsuite/g++.dg/eh/dtor4.C b/gcc/testsuite/g++.dg/eh/dtor4.C
index 6c0e804fe8a..daf6d926324 100644
--- a/gcc/testsuite/g++.dg/eh/dtor4.C
+++ b/gcc/testsuite/g++.dg/eh/dtor4.C
@@ -1,5 +1,7 @@
 // PR c++/109172
 
+// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
+
 class Demo
 {
   ~Demo();
diff --git a/gcc/testsuite/g++.dg/eh/pr42859.C b/gcc/testsuite/g++.dg/eh/pr42859.C
index 0de91409c83..5533869190b 100644
--- a/gcc/testsuite/g++.dg/eh/pr42859.C
+++ b/gcc/testsuite/g++.dg/eh/pr42859.C
@@ -1,4 +1,5 @@
 // { dg-do compile }
+// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
 
 void start (void);
 void
diff --git a/gcc/testsuite/g++.dg/ext/stmtexpr25.C b/gcc/testsuite/g++.dg/ext/stmtexpr25.C
index 79c40fc61c4..7326571dddf 100644
--- a/gcc/testsuite/g++.dg/ext/stmtexpr25.C
+++ b/gcc/testsuite/g++.dg/ext/stmtexpr25.C
@@ -1,6 +1,7 @@
 // PR c++/81073
 // { dg-options "" }
 // { dg-do compile { target c++11 } }
+// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
 
 struct test { const int *addr; };
 
diff --git a/gcc/testsuite/g++.dg/ext/vla4.C b/gcc/testsuite/g++.dg/ext/vla4.C
index e96f2735f8a..d4686d450ad 100644
--- a/gcc/testsuite/g++.dg/ext/vla4.C
+++ b/gcc/testsuite/g++.dg/ext/vla4.C
@@ -1,4 +1,5 @@
 // PR c++/29318
+// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
 // { dg-options "" }
 
 #include <typeinfo>
diff --git a/gcc/testsuite/g++.dg/init/placement4.C b/gcc/testsuite/g++.dg/init/placement4.C
index 3cfe27d63e6..6e755f93d21 100644
--- a/gcc/testsuite/g++.dg/init/placement4.C
+++ b/gcc/testsuite/g++.dg/init/placement4.C
@@ -1,5 +1,7 @@
 // PR c++/34158
 
+// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
+
 typedef __SIZE_TYPE__ size_t;
 extern "C" void* malloc (size_t);
 extern "C" void free (void *);
diff --git a/gcc/testsuite/g++.dg/other/error32.C b/gcc/testsuite/g++.dg/other/error32.C
index 56d3b7aec8b..4af7f777e5a 100644
--- a/gcc/testsuite/g++.dg/other/error32.C
+++ b/gcc/testsuite/g++.dg/other/error32.C
@@ -1,4 +1,5 @@
 // PR c++/33492
+// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
 // { dg-options "" }
 
 void foo()
diff --git a/gcc/testsuite/g++.dg/parse/crash55.C b/gcc/testsuite/g++.dg/parse/crash55.C
index 2e88c476fc7..c7b7de041ac 100644
--- a/gcc/testsuite/g++.dg/parse/crash55.C
+++ b/gcc/testsuite/g++.dg/parse/crash55.C
@@ -1,5 +1,7 @@
 // PR c++/42038
 
+// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
+
 extern int __cxa_begin_catch;	// { dg-message "previous declaration" }
 
 void f(void)
diff --git a/gcc/testsuite/g++.dg/parse/pr31952-2.C b/gcc/testsuite/g++.dg/parse/pr31952-2.C
index f09bcab1b85..bf666b7ca3e 100644
--- a/gcc/testsuite/g++.dg/parse/pr31952-2.C
+++ b/gcc/testsuite/g++.dg/parse/pr31952-2.C
@@ -1,5 +1,7 @@
 // PR c++/31952
 
+// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
+
 void
 f0()
 {
diff --git a/gcc/testsuite/g++.dg/parse/pr31952-3.C b/gcc/testsuite/g++.dg/parse/pr31952-3.C
index b589097d36d..d57c92611fd 100644
--- a/gcc/testsuite/g++.dg/parse/pr31952-3.C
+++ b/gcc/testsuite/g++.dg/parse/pr31952-3.C
@@ -1,5 +1,7 @@
 // PR c++/31952
 
+// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
+
 int
 f0 (int bar)     // { dg-message "previously" }
 try
diff --git a/gcc/testsuite/g++.dg/tm/noexcept-7.C b/gcc/testsuite/g++.dg/tm/noexcept-7.C
index bfa675c987f..f21eaf5c8e7 100644
--- a/gcc/testsuite/g++.dg/tm/noexcept-7.C
+++ b/gcc/testsuite/g++.dg/tm/noexcept-7.C
@@ -1,4 +1,5 @@
 // FIXME the TS says atomic_noexcept calls abort, not terminate.
+// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
 // { dg-options "-fgnu-tm" }
 
 void f()
diff --git a/gcc/testsuite/g++.dg/torture/pr43257.C b/gcc/testsuite/g++.dg/torture/pr43257.C
index fab5f09c31a..b58cf097caa 100644
--- a/gcc/testsuite/g++.dg/torture/pr43257.C
+++ b/gcc/testsuite/g++.dg/torture/pr43257.C
@@ -1,4 +1,5 @@
 /* { dg-do assemble } */
+/* Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.  */
 
 class A {};
 class B {};
diff --git a/gcc/testsuite/g++.dg/torture/pr56694.C b/gcc/testsuite/g++.dg/torture/pr56694.C
index 774bac4c615..dc4dd905afd 100644
--- a/gcc/testsuite/g++.dg/torture/pr56694.C
+++ b/gcc/testsuite/g++.dg/torture/pr56694.C
@@ -1,4 +1,5 @@
 // { dg-do compile }
+// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
 // { dg-options "-fopenmp" }
 // { dg-require-effective-target fopenmp }
 
diff --git a/gcc/testsuite/g++.dg/torture/pr81659.C b/gcc/testsuite/g++.dg/torture/pr81659.C
index 074099be6fc..cfaa56fd868 100644
--- a/gcc/testsuite/g++.dg/torture/pr81659.C
+++ b/gcc/testsuite/g++.dg/torture/pr81659.C
@@ -1,4 +1,5 @@
 // { dg-do compile }
+// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
 
 void
 a (int b)
diff --git a/gcc/testsuite/g++.dg/warn/Wcatch-value-1.C b/gcc/testsuite/g++.dg/warn/Wcatch-value-1.C
index a84b337b939..835b2c7417e 100644
--- a/gcc/testsuite/g++.dg/warn/Wcatch-value-1.C
+++ b/gcc/testsuite/g++.dg/warn/Wcatch-value-1.C
@@ -1,3 +1,4 @@
+// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
 // { dg-options "-Wcatch-value=1" }
 
 struct A { virtual ~A() {} };
diff --git a/gcc/testsuite/g++.dg/warn/Wcatch-value-2.C b/gcc/testsuite/g++.dg/warn/Wcatch-value-2.C
index e20719c155b..9c6e93cfa5f 100644
--- a/gcc/testsuite/g++.dg/warn/Wcatch-value-2.C
+++ b/gcc/testsuite/g++.dg/warn/Wcatch-value-2.C
@@ -1,3 +1,4 @@
+// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
 // { dg-options "-Wcatch-value=2" }
 
 struct A { virtual ~A() {} };
diff --git a/gcc/testsuite/g++.dg/warn/Wcatch-value-3.C b/gcc/testsuite/g++.dg/warn/Wcatch-value-3.C
index c91a3c08590..62881025b71 100644
--- a/gcc/testsuite/g++.dg/warn/Wcatch-value-3.C
+++ b/gcc/testsuite/g++.dg/warn/Wcatch-value-3.C
@@ -1,3 +1,4 @@
+// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
 // { dg-options "-Wcatch-value=3" }
 
 struct A { virtual ~A() {} };
diff --git a/gcc/testsuite/g++.dg/warn/Wcatch-value-3b.C b/gcc/testsuite/g++.dg/warn/Wcatch-value-3b.C
index cb9af4a6019..2d37f89acfe 100644
--- a/gcc/testsuite/g++.dg/warn/Wcatch-value-3b.C
+++ b/gcc/testsuite/g++.dg/warn/Wcatch-value-3b.C
@@ -1,3 +1,4 @@
+// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
 // { dg-options "-Wcatch-value=3" }
 
 struct A { virtual ~A() {} };
diff --git a/gcc/testsuite/g++.dg/warn/Wexceptions1.C b/gcc/testsuite/g++.dg/warn/Wexceptions1.C
index af140fd0dc2..557f01b3c7a 100644
--- a/gcc/testsuite/g++.dg/warn/Wexceptions1.C
+++ b/gcc/testsuite/g++.dg/warn/Wexceptions1.C
@@ -1,5 +1,7 @@
 // PR c++/97675
 
+// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
+
 struct Base { };
 struct Child : Base { };
 int main() {
diff --git a/gcc/testsuite/g++.dg/warn/Wexceptions3.C b/gcc/testsuite/g++.dg/warn/Wexceptions3.C
index 97fda9dbd91..08d40bbf96a 100644
--- a/gcc/testsuite/g++.dg/warn/Wexceptions3.C
+++ b/gcc/testsuite/g++.dg/warn/Wexceptions3.C
@@ -1,5 +1,7 @@
 // PR c++/81660
 
+// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
+
 void bar (int);
 
 void
diff --git a/gcc/testsuite/g++.dg/warn/Winfinite-recursion-3.C b/gcc/testsuite/g++.dg/warn/Winfinite-recursion-3.C
index 166e6d5790d..ee0be59d723 100644
--- a/gcc/testsuite/g++.dg/warn/Winfinite-recursion-3.C
+++ b/gcc/testsuite/g++.dg/warn/Winfinite-recursion-3.C
@@ -1,5 +1,6 @@
 /* PR middle-end/88232 - Please implement -Winfinite-recursion
    { dg-do compile }
+   Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
    { dg-options "-Wall -Winfinite-recursion" } */
 
 typedef __SIZE_TYPE__ size_t;
diff --git a/gcc/testsuite/g++.dg/warn/Wreturn-6.C b/gcc/testsuite/g++.dg/warn/Wreturn-6.C
index 85fef0e16df..7372e88e8ca 100644
--- a/gcc/testsuite/g++.dg/warn/Wreturn-6.C
+++ b/gcc/testsuite/g++.dg/warn/Wreturn-6.C
@@ -1,5 +1,7 @@
 // PR c++/107310
 
+// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
+
 struct f
 {
   ~f();
diff --git a/gcc/testsuite/g++.dg/warn/Wstringop-truncation-2.C b/gcc/testsuite/g++.dg/warn/Wstringop-truncation-2.C
index ebbd44307d9..39827a2acee 100644
--- a/gcc/testsuite/g++.dg/warn/Wstringop-truncation-2.C
+++ b/gcc/testsuite/g++.dg/warn/Wstringop-truncation-2.C
@@ -3,6 +3,7 @@
 // Compile with -g to verify the warning deals properly with debug
 // statements.
 // { dg-do compile }
+// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
 // { dg-options "-O2 -Wstringop-truncation -g" }
 
 extern "C" char* strncpy (char*, const char*, __SIZE_TYPE__);
diff --git a/gcc/testsuite/g++.dg/warn/Wterminate1.C b/gcc/testsuite/g++.dg/warn/Wterminate1.C
index affb48d3e8a..ec0a67b60ad 100644
--- a/gcc/testsuite/g++.dg/warn/Wterminate1.C
+++ b/gcc/testsuite/g++.dg/warn/Wterminate1.C
@@ -1,6 +1,7 @@
 // In C++98 mode this gets a -Wc++11-compat warning, in C++11 mode a
 // -Wterminate warning.
 
+// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
 // { dg-options "-Wall" }
 
 struct A
diff --git a/gcc/testsuite/g++.old-deja/g++.eh/catch1.C b/gcc/testsuite/g++.old-deja/g++.eh/catch1.C
index 67779d945ea..a9a26d54437 100644
--- a/gcc/testsuite/g++.old-deja/g++.eh/catch1.C
+++ b/gcc/testsuite/g++.old-deja/g++.eh/catch1.C
@@ -1,4 +1,5 @@
 // { dg-do assemble  }
+// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
 // 
 // Copyright (C) 1999 Free Software Foundation, Inc.
 // Contributed by Nathan Sidwell 6 Jun 1999 <nathan@acm.org>
diff --git a/gcc/testsuite/g++.old-deja/g++.eh/catch10.C b/gcc/testsuite/g++.old-deja/g++.eh/catch10.C
index 7cc609645a2..19dfd87430b 100644
--- a/gcc/testsuite/g++.old-deja/g++.eh/catch10.C
+++ b/gcc/testsuite/g++.old-deja/g++.eh/catch10.C
@@ -1,4 +1,5 @@
 // { dg-do assemble  }
+// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
 // Test that we notice unfortunate handler ordering.
 
 struct A { };
diff --git a/gcc/testsuite/g++.old-deja/g++.eh/cond1.C b/gcc/testsuite/g++.old-deja/g++.eh/cond1.C
index fe6d4296ab5..18c024d29f9 100644
--- a/gcc/testsuite/g++.old-deja/g++.eh/cond1.C
+++ b/gcc/testsuite/g++.old-deja/g++.eh/cond1.C
@@ -1,4 +1,5 @@
 // { dg-do assemble  }
+// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
 
 // Copyright (C) 1999, 2000 Free Software Foundation, Inc.
 // Contributed by Nathan Sidwell 11 Apr 1999 <nathan@acm.org>
diff --git a/gcc/testsuite/g++.old-deja/g++.eh/ctor1.C b/gcc/testsuite/g++.old-deja/g++.eh/ctor1.C
index cc39ac3953f..1a14f7178be 100644
--- a/gcc/testsuite/g++.old-deja/g++.eh/ctor1.C
+++ b/gcc/testsuite/g++.old-deja/g++.eh/ctor1.C
@@ -1,4 +1,6 @@
 // { dg-do assemble  }
+// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
+
 struct A
 {
   A();
diff --git a/gcc/testsuite/g++.old-deja/g++.eh/throw2.C b/gcc/testsuite/g++.old-deja/g++.eh/throw2.C
index 957c200f8af..7302dac6078 100644
--- a/gcc/testsuite/g++.old-deja/g++.eh/throw2.C
+++ b/gcc/testsuite/g++.old-deja/g++.eh/throw2.C
@@ -1,4 +1,5 @@
 // { dg-do assemble  }
+// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
 
 // Submitted by Sebastian Ritterbusch <uabp@rz.uni-karlsruhe.de>
 
diff --git a/gcc/testsuite/g++.old-deja/g++.other/cond5.C b/gcc/testsuite/g++.old-deja/g++.other/cond5.C
index 0d2baf9edf7..6e9ac1bfc1d 100644
--- a/gcc/testsuite/g++.old-deja/g++.other/cond5.C
+++ b/gcc/testsuite/g++.old-deja/g++.other/cond5.C
@@ -1,4 +1,5 @@
 // { dg-do assemble  }
+// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
 // { dg-options "-W -pedantic -ansi" }
 
 // Copyright (C) 1999, 2000 Free Software Foundation, Inc.
-- 
2.34.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Skip a number of 'g++.dg/compat/' test cases for '-fno-exceptions' testing (was: Skip a number of C++ "split files" test cases for '-fno-exceptions' testing (was: Skip a number of C++ test cases for '-fno-exceptions' testing (was: Support in the GCC(/C++) test suites for '-fno-exceptions')))
  2023-06-15 15:47     ` Skip a number of C++ "split files" test cases for '-fno-exceptions' testing (was: Skip a number of C++ test cases for '-fno-exceptions' testing (was: Support in the GCC(/C++) test suites for '-fno-exceptions')) Thomas Schwinge
@ 2023-11-03 11:08       ` Thomas Schwinge
  2023-11-03 11:10       ` Skip a number of 'g++.dg/lto/' " Thomas Schwinge
  1 sibling, 0 replies; 14+ messages in thread
From: Thomas Schwinge @ 2023-11-03 11:08 UTC (permalink / raw)
  To: gcc-patches, Jason Merrill; +Cc: Jonathan Wakely, Nathan Sidwell

[-- Attachment #1: Type: text/plain, Size: 666 bytes --]

Hi!

On 2023-06-15T17:47:57+0200, I wrote:
> [...], OK to push the attached
> "Skip a number of C++ "split files" test cases for '-fno-exceptions' testing"?

The 'g++.dg/compat/' parts of this pushed to master branch in
commit e5919951b8cb0dc8af5b80dc747416fb60a9835b
"Skip a number of 'g++.dg/compat/' test cases for '-fno-exceptions' testing",
see attached.


Grüße
 Thomas


-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Skip-a-number-of-g-.dg-compat-test-cases-for-fno-exc.patch --]
[-- Type: text/x-diff, Size: 8603 bytes --]

From e5919951b8cb0dc8af5b80dc747416fb60a9835b Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Wed, 7 Jun 2023 16:11:11 +0200
Subject: [PATCH] Skip a number of 'g++.dg/compat/' test cases for
 '-fno-exceptions' testing

Running 'make check' with: 'RUNTESTFLAGS=--target_board=unix/-fno-exceptions',
'error: exception handling disabled' is triggered for C++ 'throw' etc. usage,
and per 'gcc/testsuite/lib/gcc-dg.exp:gcc-dg-prune':

    # If exceptions are disabled, mark tests expecting exceptions to be enabled
    # as unsupported.
    if { ![check_effective_target_exceptions_enabled] } {
        if [regexp "(^|\n)\[^\n\]*: error: exception handling disabled" $text] {
          return "::unsupported::exception handling disabled"
        }

..., which generally means:

    -PASS: [...] (test for excess errors)
    +UNSUPPORTED: [...]: exception handling disabled

However, this doesn't work for "split files" test cases.  For example:

    PASS: g++.dg/compat/eh/ctor1 cp_compat_main_tst.o compile
    [-PASS:-]{+UNSUPPORTED:+} g++.dg/compat/eh/ctor1 cp_compat_x_tst.o [-compile-]{+compile: exception handling disabled+}
    [-PASS:-]{+UNSUPPORTED:+} g++.dg/compat/eh/ctor1 cp_compat_y_tst.o [-compile-]{+compile: exception handling disabled+}
    [-PASS:-]{+UNRESOLVED:+} g++.dg/compat/eh/ctor1 cp_compat_x_tst.o-cp_compat_y_tst.o link
    [-PASS:-]{+UNRESOLVED:+} g++.dg/compat/eh/ctor1 cp_compat_x_tst.o-cp_compat_y_tst.o execute

The "compile"/"assemble" tests (either continue to work, or) result in the
expected 'UNSUPPORTED: [...] compile: exception handling disabled', but
dependent "link" and "execute" tests then turn UNRESOLVED.

Specify 'dg-require-effective-target exceptions_enabled' for those test cases.

	gcc/testsuite/
	* g++.dg/compat/eh/ctor1_main.C: Specify
	'dg-require-effective-target exceptions_enabled'.
	* g++.dg/compat/eh/ctor2_main.C: Likewise.
	* g++.dg/compat/eh/dtor1_main.C: Likewise.
	* g++.dg/compat/eh/filter1_main.C: Likewise.
	* g++.dg/compat/eh/filter2_main.C: Likewise.
	* g++.dg/compat/eh/new1_main.C: Likewise.
	* g++.dg/compat/eh/nrv1_main.C: Likewise.
	* g++.dg/compat/eh/spec3_main.C: Likewise.
	* g++.dg/compat/eh/template1_main.C: Likewise.
	* g++.dg/compat/eh/unexpected1_main.C: Likewise.
	* g++.dg/compat/init/array5_main.C: Likewise.
---
 gcc/testsuite/g++.dg/compat/eh/ctor1_main.C       | 2 ++
 gcc/testsuite/g++.dg/compat/eh/ctor2_main.C       | 2 ++
 gcc/testsuite/g++.dg/compat/eh/dtor1_main.C       | 2 ++
 gcc/testsuite/g++.dg/compat/eh/filter1_main.C     | 2 ++
 gcc/testsuite/g++.dg/compat/eh/filter2_main.C     | 2 ++
 gcc/testsuite/g++.dg/compat/eh/new1_main.C        | 2 ++
 gcc/testsuite/g++.dg/compat/eh/nrv1_main.C        | 2 ++
 gcc/testsuite/g++.dg/compat/eh/spec3_main.C       | 2 ++
 gcc/testsuite/g++.dg/compat/eh/template1_main.C   | 2 ++
 gcc/testsuite/g++.dg/compat/eh/unexpected1_main.C | 2 ++
 gcc/testsuite/g++.dg/compat/init/array5_main.C    | 2 ++
 11 files changed, 22 insertions(+)

diff --git a/gcc/testsuite/g++.dg/compat/eh/ctor1_main.C b/gcc/testsuite/g++.dg/compat/eh/ctor1_main.C
index a188b46da86..1598d9db0f8 100644
--- a/gcc/testsuite/g++.dg/compat/eh/ctor1_main.C
+++ b/gcc/testsuite/g++.dg/compat/eh/ctor1_main.C
@@ -4,6 +4,8 @@
 
 // Split into pieces for binary compatibility testing October 2002
 
+// Explicit { dg-require-effective-target exceptions_enabled } so that dependent tests don't turn UNRESOLVED for '-fno-exceptions'.
+
 extern void ctor1_x (void);
 
 int
diff --git a/gcc/testsuite/g++.dg/compat/eh/ctor2_main.C b/gcc/testsuite/g++.dg/compat/eh/ctor2_main.C
index 58836e26eba..f79c8a2e756 100644
--- a/gcc/testsuite/g++.dg/compat/eh/ctor2_main.C
+++ b/gcc/testsuite/g++.dg/compat/eh/ctor2_main.C
@@ -4,6 +4,8 @@
 
 // Split into pieces for binary compatibility testing October 2002
 
+// Explicit { dg-require-effective-target exceptions_enabled } so that dependent tests don't turn UNRESOLVED for '-fno-exceptions'.
+
 extern void ctor2_x (void);
 
 int main ()
diff --git a/gcc/testsuite/g++.dg/compat/eh/dtor1_main.C b/gcc/testsuite/g++.dg/compat/eh/dtor1_main.C
index 962fa64274b..1550d7403c6 100644
--- a/gcc/testsuite/g++.dg/compat/eh/dtor1_main.C
+++ b/gcc/testsuite/g++.dg/compat/eh/dtor1_main.C
@@ -5,6 +5,8 @@
 
 // Split into pieces for binary compatibility testing October 2002
 
+// Explicit { dg-require-effective-target exceptions_enabled } so that dependent tests don't turn UNRESOLVED for '-fno-exceptions'.
+
 extern void dtor1_x (void);
 
 int
diff --git a/gcc/testsuite/g++.dg/compat/eh/filter1_main.C b/gcc/testsuite/g++.dg/compat/eh/filter1_main.C
index 2a8fca42c31..39eb6e4b66d 100644
--- a/gcc/testsuite/g++.dg/compat/eh/filter1_main.C
+++ b/gcc/testsuite/g++.dg/compat/eh/filter1_main.C
@@ -2,6 +2,8 @@
 
 // Split into pieces for binary compatibility testing October 2002
 
+// Explicit { dg-require-effective-target exceptions_enabled } so that dependent tests don't turn UNRESOLVED for '-fno-exceptions'.
+
 extern void filter1_x (void);
 
 int
diff --git a/gcc/testsuite/g++.dg/compat/eh/filter2_main.C b/gcc/testsuite/g++.dg/compat/eh/filter2_main.C
index 866199c6b30..43ecf8a946b 100644
--- a/gcc/testsuite/g++.dg/compat/eh/filter2_main.C
+++ b/gcc/testsuite/g++.dg/compat/eh/filter2_main.C
@@ -3,6 +3,8 @@
 
 // Split into pieces for binary compatibility testing October 2002
 
+// Explicit { dg-require-effective-target exceptions_enabled } so that dependent tests don't turn UNRESOLVED for '-fno-exceptions'.
+
 extern void filter2_x (void);
 
 int
diff --git a/gcc/testsuite/g++.dg/compat/eh/new1_main.C b/gcc/testsuite/g++.dg/compat/eh/new1_main.C
index ee4cad8e50d..a557c9d1814 100644
--- a/gcc/testsuite/g++.dg/compat/eh/new1_main.C
+++ b/gcc/testsuite/g++.dg/compat/eh/new1_main.C
@@ -4,6 +4,8 @@
 
 // Split into pieces for binary compatibility testing October 2002
 
+// Explicit { dg-require-effective-target exceptions_enabled } so that dependent tests don't turn UNRESOLVED for '-fno-exceptions'.
+
 extern void new1_x (void);
 
 int
diff --git a/gcc/testsuite/g++.dg/compat/eh/nrv1_main.C b/gcc/testsuite/g++.dg/compat/eh/nrv1_main.C
index 3b76b5c8824..5df3c51f634 100644
--- a/gcc/testsuite/g++.dg/compat/eh/nrv1_main.C
+++ b/gcc/testsuite/g++.dg/compat/eh/nrv1_main.C
@@ -3,6 +3,8 @@
 
 // Split into pieces for binary compatibility testing October 2002
 
+// Explicit { dg-require-effective-target exceptions_enabled } so that dependent tests don't turn UNRESOLVED for '-fno-exceptions'.
+
 extern void nrv1_x (void);
 
 int
diff --git a/gcc/testsuite/g++.dg/compat/eh/spec3_main.C b/gcc/testsuite/g++.dg/compat/eh/spec3_main.C
index 3f0e919b2ea..8255fc19eeb 100644
--- a/gcc/testsuite/g++.dg/compat/eh/spec3_main.C
+++ b/gcc/testsuite/g++.dg/compat/eh/spec3_main.C
@@ -3,6 +3,8 @@
 
 // Split into pieces for binary compatibility testing October 2002
 
+// Explicit { dg-require-effective-target exceptions_enabled } so that dependent tests don't turn UNRESOLVED for '-fno-exceptions'.
+
 extern void spec3_x (void);
 
 int
diff --git a/gcc/testsuite/g++.dg/compat/eh/template1_main.C b/gcc/testsuite/g++.dg/compat/eh/template1_main.C
index 2d169808c46..5ff13276071 100644
--- a/gcc/testsuite/g++.dg/compat/eh/template1_main.C
+++ b/gcc/testsuite/g++.dg/compat/eh/template1_main.C
@@ -3,6 +3,8 @@
 
 // Split into pieces for binary compatibility testing October 2002
 
+// Explicit { dg-require-effective-target exceptions_enabled } so that dependent tests don't turn UNRESOLVED for '-fno-exceptions'.
+
 extern void template1_x (void);
 
 int
diff --git a/gcc/testsuite/g++.dg/compat/eh/unexpected1_main.C b/gcc/testsuite/g++.dg/compat/eh/unexpected1_main.C
index 1658db77e32..99e667dedf9 100644
--- a/gcc/testsuite/g++.dg/compat/eh/unexpected1_main.C
+++ b/gcc/testsuite/g++.dg/compat/eh/unexpected1_main.C
@@ -3,6 +3,8 @@
 
 // Split into pieces for binary compatibility testing October 2002
 
+// Explicit { dg-require-effective-target exceptions_enabled } so that dependent tests don't turn UNRESOLVED for '-fno-exceptions'.
+
 extern void unexpected1_x ();
 
 int
diff --git a/gcc/testsuite/g++.dg/compat/init/array5_main.C b/gcc/testsuite/g++.dg/compat/init/array5_main.C
index 96b2cc4b12b..814411e66d6 100644
--- a/gcc/testsuite/g++.dg/compat/init/array5_main.C
+++ b/gcc/testsuite/g++.dg/compat/init/array5_main.C
@@ -5,6 +5,8 @@
 // Incorrect construction and destruction of multi-dimensional
 // array of class.
 
+// Explicit { dg-require-effective-target exceptions_enabled } so that dependent tests don't turn UNRESOLVED for '-fno-exceptions'.
+
 extern void array5_x (void);
 
 int
-- 
2.34.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Skip a number of 'g++.dg/lto/' test cases for '-fno-exceptions' testing (was: Skip a number of C++ "split files" test cases for '-fno-exceptions' testing (was: Skip a number of C++ test cases for '-fno-exceptions' testing (was: Support in the GCC(/C++) test suites for '-fno-exceptions')))
  2023-06-15 15:47     ` Skip a number of C++ "split files" test cases for '-fno-exceptions' testing (was: Skip a number of C++ test cases for '-fno-exceptions' testing (was: Support in the GCC(/C++) test suites for '-fno-exceptions')) Thomas Schwinge
  2023-11-03 11:08       ` Skip a number of 'g++.dg/compat/' test cases for '-fno-exceptions' testing (was: Skip a number of C++ "split files" test cases for '-fno-exceptions' testing (was: Skip a number of C++ test cases for '-fno-exceptions' testing (was: Support in the GCC(/C++) test suites for '-fno-exceptions'))) Thomas Schwinge
@ 2023-11-03 11:10       ` Thomas Schwinge
  1 sibling, 0 replies; 14+ messages in thread
From: Thomas Schwinge @ 2023-11-03 11:10 UTC (permalink / raw)
  To: gcc-patches, Jason Merrill; +Cc: Jonathan Wakely, Nathan Sidwell

[-- Attachment #1: Type: text/plain, Size: 660 bytes --]

Hi!

On 2023-06-15T17:47:57+0200, I wrote:
> [...], OK to push the attached
> "Skip a number of C++ "split files" test cases for '-fno-exceptions' testing"?

The 'g++.dg/lto/' parts of this pushed to master branch in
commit 94782ed70796427e6f4b15b1c2df91cd7bef28e8
"Skip a number of 'g++.dg/lto/' test cases for '-fno-exceptions' testing",
see attached.


Grüße
 Thomas


-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Skip-a-number-of-g-.dg-lto-test-cases-for-fno-except.patch --]
[-- Type: text/x-diff, Size: 4829 bytes --]

From 94782ed70796427e6f4b15b1c2df91cd7bef28e8 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Wed, 7 Jun 2023 16:11:11 +0200
Subject: [PATCH] Skip a number of 'g++.dg/lto/' test cases for
 '-fno-exceptions' testing

Running 'make check' with: 'RUNTESTFLAGS=--target_board=unix/-fno-exceptions',
'error: exception handling disabled' is triggered for C++ 'throw' etc. usage,
and per 'gcc/testsuite/lib/gcc-dg.exp:gcc-dg-prune':

    # If exceptions are disabled, mark tests expecting exceptions to be enabled
    # as unsupported.
    if { ![check_effective_target_exceptions_enabled] } {
        if [regexp "(^|\n)\[^\n\]*: error: exception handling disabled" $text] {
          return "::unsupported::exception handling disabled"
        }

..., which generally means:

    -PASS: [...] (test for excess errors)
    +UNSUPPORTED: [...]: exception handling disabled

However, this doesn't work for "split files" test cases.  For example:

    [-PASS:-]{+UNSUPPORTED:+} g++.dg/lto/20081109-1 cp_lto_20081109-1_0.o [-assemble, -fPIC -flto -flto-partition=1to1-]{+assemble: exception handling disabled+}
    [-PASS:-]{+UNRESOLVED:+} g++.dg/lto/20081109-1 cp_lto_20081109-1_0.o-cp_lto_20081109-1_0.o [-link,-]{+link+} -fPIC -flto -flto-partition=1to1
    {+UNRESOLVED: g++.dg/lto/20081109-1 cp_lto_20081109-1_0.o-cp_lto_20081109-1_0.o execute -fPIC -flto -flto-partition=1to1+}

The "compile"/"assemble" tests (either continue to work, or) result in the
expected 'UNSUPPORTED: [...] compile: exception handling disabled', but
dependent "link" and "execute" tests then turn UNRESOLVED.

Specify 'dg-require-effective-target exceptions_enabled' for those test cases.

	gcc/testsuite/
	* g++.dg/lto/20081109-1_0.C: Specify
	'dg-require-effective-target exceptions_enabled'.
	* g++.dg/lto/20081109_0.C: Likewise.
	* g++.dg/lto/20091026-1_0.C: Likewise.
	* g++.dg/lto/pr87906_0.C: Likewise.
	* g++.dg/lto/pr88046_0.C: Likewise.
---
 gcc/testsuite/g++.dg/lto/20081109-1_0.C | 1 +
 gcc/testsuite/g++.dg/lto/20081109_0.C   | 2 ++
 gcc/testsuite/g++.dg/lto/20091026-1_0.C | 1 +
 gcc/testsuite/g++.dg/lto/pr87906_0.C    | 1 +
 gcc/testsuite/g++.dg/lto/pr88046_0.C    | 1 +
 5 files changed, 6 insertions(+)

diff --git a/gcc/testsuite/g++.dg/lto/20081109-1_0.C b/gcc/testsuite/g++.dg/lto/20081109-1_0.C
index db0ba367fe8..7dc315b39ed 100644
--- a/gcc/testsuite/g++.dg/lto/20081109-1_0.C
+++ b/gcc/testsuite/g++.dg/lto/20081109-1_0.C
@@ -1,4 +1,5 @@
 // { dg-lto-do link }
+// Explicit { dg-require-effective-target exceptions_enabled } so that dependent tests don't turn UNRESOLVED for '-fno-exceptions'.
 // { dg-require-effective-target fpic }
 // { dg-lto-options {{-fPIC -flto -flto-partition=1to1}} }
 // { dg-extra-ld-options "-fPIC -flto -flto-partition=1to1 -r -fno-exceptions -flinker-output=nolto-rel" }
diff --git a/gcc/testsuite/g++.dg/lto/20081109_0.C b/gcc/testsuite/g++.dg/lto/20081109_0.C
index 93cfc67fff2..4746e1c7c46 100644
--- a/gcc/testsuite/g++.dg/lto/20081109_0.C
+++ b/gcc/testsuite/g++.dg/lto/20081109_0.C
@@ -1,3 +1,5 @@
+// Explicit { dg-require-effective-target exceptions_enabled } so that dependent tests don't turn UNRESOLVED for '-fno-exceptions'.
+
 extern "C" { void abort (void);}
 int foo (int);
 
diff --git a/gcc/testsuite/g++.dg/lto/20091026-1_0.C b/gcc/testsuite/g++.dg/lto/20091026-1_0.C
index 06eff292cb6..ca0729c52f5 100644
--- a/gcc/testsuite/g++.dg/lto/20091026-1_0.C
+++ b/gcc/testsuite/g++.dg/lto/20091026-1_0.C
@@ -1,4 +1,5 @@
 // { dg-lto-do link }
+// Explicit { dg-require-effective-target exceptions_enabled } so that dependent tests don't turn UNRESOLVED for '-fno-exceptions'.
 // { dg-extra-ld-options "-r -nostdlib -flinker-output=nolto-rel" }
 
 #include "20091026-1_a.h"
diff --git a/gcc/testsuite/g++.dg/lto/pr87906_0.C b/gcc/testsuite/g++.dg/lto/pr87906_0.C
index 6a04cd5c6f0..623c29ca007 100644
--- a/gcc/testsuite/g++.dg/lto/pr87906_0.C
+++ b/gcc/testsuite/g++.dg/lto/pr87906_0.C
@@ -1,4 +1,5 @@
 // { dg-lto-do link }
+// Explicit { dg-require-effective-target exceptions_enabled } so that dependent tests don't turn UNRESOLVED for '-fno-exceptions'.
 // { dg-require-effective-target fpic }
 // { dg-require-effective-target shared }
 // { dg-lto-options { { -O -fPIC -flto } } }
diff --git a/gcc/testsuite/g++.dg/lto/pr88046_0.C b/gcc/testsuite/g++.dg/lto/pr88046_0.C
index 734ce86e9b8..99224b5011f 100644
--- a/gcc/testsuite/g++.dg/lto/pr88046_0.C
+++ b/gcc/testsuite/g++.dg/lto/pr88046_0.C
@@ -1,5 +1,6 @@
 // { dg-lto-do link }
 // { dg-lto-options { { -O2 -fPIC -flto } } }
+// Explicit { dg-require-effective-target exceptions_enabled } so that dependent tests don't turn UNRESOLVED for '-fno-exceptions'.
 // { dg-require-effective-target shared }
 // { dg-require-effective-target fpic }
 // { dg-extra-ld-options "-shared -g" }
-- 
2.34.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Skip a number of 'g++.dg/tree-prof/' test cases for '-fno-exceptions' testing (was: Skip a number of C++ test cases for '-fno-exceptions' testing (was: Support in the GCC(/C++) test suites for '-fno-exceptions'))
  2023-06-15 16:04     ` Skip a number of C++ 'g++.dg/tree-prof/' test cases for '-fno-exceptions' testing (was: Skip a number of C++ test cases for '-fno-exceptions' testing (was: Support in the GCC(/C++) test suites for '-fno-exceptions')) Thomas Schwinge
@ 2023-11-03 11:12       ` Thomas Schwinge
  0 siblings, 0 replies; 14+ messages in thread
From: Thomas Schwinge @ 2023-11-03 11:12 UTC (permalink / raw)
  To: gcc-patches, Jason Merrill; +Cc: Jonathan Wakely, Nathan Sidwell

[-- Attachment #1: Type: text/plain, Size: 636 bytes --]

Hi!

On 2023-06-15T18:04:04+0200, I wrote:
> [...], OK to push the attached
> "Skip a number of C++ 'g++.dg/tree-prof/' test cases for '-fno-exceptions' testing"?

Pushed to master branch commit 3881d010dca9b5db5301f28e4a1e3a8e4bc40faa
"Skip a number of 'g++.dg/tree-prof/' test cases for '-fno-exceptions' testing",
see attached.


Grüße
 Thomas


-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Skip-a-number-of-g-.dg-tree-prof-test-cases-for-fno-.patch --]
[-- Type: text/x-diff, Size: 5986 bytes --]

From 3881d010dca9b5db5301f28e4a1e3a8e4bc40faa Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Wed, 14 Jun 2023 22:39:01 +0200
Subject: [PATCH] Skip a number of 'g++.dg/tree-prof/' test cases for
 '-fno-exceptions' testing

Running 'make check' with: 'RUNTESTFLAGS=--target_board=unix/-fno-exceptions',
'error: exception handling disabled' is triggered for C++ 'throw' etc. usage,
and per 'gcc/testsuite/lib/gcc-dg.exp:gcc-dg-prune':

    # If exceptions are disabled, mark tests expecting exceptions to be enabled
    # as unsupported.
    if { ![check_effective_target_exceptions_enabled] } {
        if [regexp "(^|\n)\[^\n\]*: error: exception handling disabled" $text] {
          return "::unsupported::exception handling disabled"
        }

..., which generally means:

    -PASS: [...] (test for excess errors)
    +UNSUPPORTED: [...]: exception handling disabled

However, this doesn't work for 'g++.dg/tree-prof/' test cases.  For example:

    [-PASS:-]{+UNSUPPORTED:+} g++.dg/tree-prof/indir-call-prof-2.C [-compilation,  -fprofile-generate -D_PROFILE_GENERATE-]{+compilation: exception handling disabled+}
    [-PASS:-]{+UNRESOLVED:+} g++.dg/tree-prof/indir-call-prof-2.C execution,    -fprofile-generate -D_PROFILE_GENERATE
    [-PASS:-]{+UNRESOLVED:+} g++.dg/tree-prof/indir-call-prof-2.C compilation,  -fprofile-use -D_PROFILE_USE
    [-PASS:-]{+UNRESOLVED:+} g++.dg/tree-prof/indir-call-prof-2.C execution,    -fprofile-use -D_PROFILE_USE

Dependent tests turn UNRESOLVED if the first "compilation" runs into the
expected 'UNSUPPORTED: [...] compile: exception handling disabled'.

Specify 'dg-require-effective-target exceptions_enabled' for those test cases.

	gcc/testsuite/
	* g++.dg/tree-prof/indir-call-prof-2.C: Specify
	'dg-require-effective-target exceptions_enabled'.
	* g++.dg/tree-prof/partition1.C: Likewise.
	* g++.dg/tree-prof/partition2.C: Likewise.
	* g++.dg/tree-prof/partition3.C: Likewise.
	* g++.dg/tree-prof/pr51719.C: Likewise.
	* g++.dg/tree-prof/pr57451.C: Likewise.
	* g++.dg/tree-prof/pr59255.C: Likewise.
---
 gcc/testsuite/g++.dg/tree-prof/indir-call-prof-2.C | 1 +
 gcc/testsuite/g++.dg/tree-prof/partition1.C        | 1 +
 gcc/testsuite/g++.dg/tree-prof/partition2.C        | 1 +
 gcc/testsuite/g++.dg/tree-prof/partition3.C        | 1 +
 gcc/testsuite/g++.dg/tree-prof/pr51719.C           | 1 +
 gcc/testsuite/g++.dg/tree-prof/pr57451.C           | 1 +
 gcc/testsuite/g++.dg/tree-prof/pr59255.C           | 1 +
 7 files changed, 7 insertions(+)

diff --git a/gcc/testsuite/g++.dg/tree-prof/indir-call-prof-2.C b/gcc/testsuite/g++.dg/tree-prof/indir-call-prof-2.C
index e20cc64d373..5b6f172b025 100644
--- a/gcc/testsuite/g++.dg/tree-prof/indir-call-prof-2.C
+++ b/gcc/testsuite/g++.dg/tree-prof/indir-call-prof-2.C
@@ -1,3 +1,4 @@
+/* Explicit { dg-require-effective-target exceptions_enabled } so that dependent tests don't turn UNRESOLVED for '-fno-exceptions'.  */
 /* { dg-options "-O" } */
 
 int foo1(void) { return 0; }
diff --git a/gcc/testsuite/g++.dg/tree-prof/partition1.C b/gcc/testsuite/g++.dg/tree-prof/partition1.C
index d0dcbc4524b..8dd64aa27a5 100644
--- a/gcc/testsuite/g++.dg/tree-prof/partition1.C
+++ b/gcc/testsuite/g++.dg/tree-prof/partition1.C
@@ -1,3 +1,4 @@
+/* Explicit { dg-require-effective-target exceptions_enabled } so that dependent tests don't turn UNRESOLVED for '-fno-exceptions'.  */
 /* { dg-require-effective-target freorder } */
 /* { dg-options "-O2 -freorder-blocks-and-partition" } */
 
diff --git a/gcc/testsuite/g++.dg/tree-prof/partition2.C b/gcc/testsuite/g++.dg/tree-prof/partition2.C
index 0bc50fae98a..580d0e06c00 100644
--- a/gcc/testsuite/g++.dg/tree-prof/partition2.C
+++ b/gcc/testsuite/g++.dg/tree-prof/partition2.C
@@ -1,4 +1,5 @@
 // PR middle-end/45458
+// Explicit { dg-require-effective-target exceptions_enabled } so that dependent tests don't turn UNRESOLVED for '-fno-exceptions'.
 // { dg-require-effective-target freorder }
 // { dg-options "-O2 -fnon-call-exceptions -freorder-blocks-and-partition" }
 
diff --git a/gcc/testsuite/g++.dg/tree-prof/partition3.C b/gcc/testsuite/g++.dg/tree-prof/partition3.C
index c62174aa4d3..6cd51cc157e 100644
--- a/gcc/testsuite/g++.dg/tree-prof/partition3.C
+++ b/gcc/testsuite/g++.dg/tree-prof/partition3.C
@@ -1,4 +1,5 @@
 // PR middle-end/45566
+// Explicit { dg-require-effective-target exceptions_enabled } so that dependent tests don't turn UNRESOLVED for '-fno-exceptions'.
 // { dg-require-effective-target freorder }
 // { dg-options "-O2 -fnon-call-exceptions -freorder-blocks-and-partition" }
 
diff --git a/gcc/testsuite/g++.dg/tree-prof/pr51719.C b/gcc/testsuite/g++.dg/tree-prof/pr51719.C
index 01e81ff66ed..a4c99a1db87 100644
--- a/gcc/testsuite/g++.dg/tree-prof/pr51719.C
+++ b/gcc/testsuite/g++.dg/tree-prof/pr51719.C
@@ -1,4 +1,5 @@
 // PR tree-optimization/51719
+// Explicit { dg-require-effective-target exceptions_enabled } so that dependent tests don't turn UNRESOLVED for '-fno-exceptions'.
 // { dg-options "-O -fpartial-inlining" }
 
 int
diff --git a/gcc/testsuite/g++.dg/tree-prof/pr57451.C b/gcc/testsuite/g++.dg/tree-prof/pr57451.C
index db0fcc1e8ef..8fbc1214095 100644
--- a/gcc/testsuite/g++.dg/tree-prof/pr57451.C
+++ b/gcc/testsuite/g++.dg/tree-prof/pr57451.C
@@ -1,3 +1,4 @@
+// Explicit { dg-require-effective-target exceptions_enabled } so that dependent tests don't turn UNRESOLVED for '-fno-exceptions'.
 // { dg-require-effective-target freorder }
 // { dg-options "-O2 -freorder-blocks-and-partition -g" }
 
diff --git a/gcc/testsuite/g++.dg/tree-prof/pr59255.C b/gcc/testsuite/g++.dg/tree-prof/pr59255.C
index 77f208a3a5f..6db136846d0 100644
--- a/gcc/testsuite/g++.dg/tree-prof/pr59255.C
+++ b/gcc/testsuite/g++.dg/tree-prof/pr59255.C
@@ -1,4 +1,5 @@
 // PR c++/59255
+// Explicit { dg-require-effective-target exceptions_enabled } so that dependent tests don't turn UNRESOLVED for '-fno-exceptions'.
 // { dg-options "-std=c++11 -O2" }
 
 struct S
-- 
2.34.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Skip a number of C++ test cases for '-fno-exceptions' testing (was: Support in the GCC(/C++) test suites for '-fno-exceptions')
  2023-11-03 11:03       ` Thomas Schwinge
@ 2023-11-03 11:15         ` Jakub Jelinek
  0 siblings, 0 replies; 14+ messages in thread
From: Jakub Jelinek @ 2023-11-03 11:15 UTC (permalink / raw)
  To: Thomas Schwinge
  Cc: Jason Merrill, gcc-patches, libstdc++, Jonathan Wakely, Nathan Sidwell

On Fri, Nov 03, 2023 at 12:03:06PM +0100, Thomas Schwinge wrote:
> --- a/gcc/testsuite/g++.dg/cpp0x/catch1.C
> +++ b/gcc/testsuite/g++.dg/cpp0x/catch1.C
> @@ -1,5 +1,6 @@
>  // PR c++/53371
>  // { dg-do compile { target c++11 } }
> +// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.

Ugh, this is just too ugly.
Please don't mix explanation comment with a directive, one line should be
just a directive and you can add explanation in a line above it.

	Jakub


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2023-11-03 11:15 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <873534qu9e.fsf@euler.schwinge.homeip.net>
     [not found] ` <CACb0b4kDiwp5nEY952rbLAKy7_+iJey71z3WNMUxahTaLQt6vA@mail.gmail.com>
2023-06-07  7:13   ` Support 'UNSUPPORTED: [...]: exception handling disabled' for libstdc++ testing (was: Support in the GCC(/C++) test suites for '-fno-exceptions') Thomas Schwinge
2023-06-07  8:12     ` Jonathan Wakely
2023-06-07  9:08       ` Thomas Schwinge
2023-06-07 11:51         ` Jonathan Wakely
2023-06-07 15:56           ` Jonathan Wakely
2023-06-15 15:15   ` Skip a number of C++ test cases for '-fno-exceptions' " Thomas Schwinge
2023-06-15 15:47     ` Skip a number of C++ "split files" test cases for '-fno-exceptions' testing (was: Skip a number of C++ test cases for '-fno-exceptions' testing (was: Support in the GCC(/C++) test suites for '-fno-exceptions')) Thomas Schwinge
2023-11-03 11:08       ` Skip a number of 'g++.dg/compat/' test cases for '-fno-exceptions' testing (was: Skip a number of C++ "split files" test cases for '-fno-exceptions' testing (was: Skip a number of C++ test cases for '-fno-exceptions' testing (was: Support in the GCC(/C++) test suites for '-fno-exceptions'))) Thomas Schwinge
2023-11-03 11:10       ` Skip a number of 'g++.dg/lto/' " Thomas Schwinge
2023-06-15 16:04     ` Skip a number of C++ 'g++.dg/tree-prof/' test cases for '-fno-exceptions' testing (was: Skip a number of C++ test cases for '-fno-exceptions' testing (was: Support in the GCC(/C++) test suites for '-fno-exceptions')) Thomas Schwinge
2023-11-03 11:12       ` Skip a number of " Thomas Schwinge
2023-09-08 13:30     ` Skip a number of C++ test cases for '-fno-exceptions' testing (was: Support in the GCC(/C++) test suites for '-fno-exceptions') Thomas Schwinge
2023-11-03 11:03       ` Thomas Schwinge
2023-11-03 11:15         ` Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).