Bug 98785 - _Unwind_ForcedUnwind going through a non-empty exception specification
Summary: _Unwind_ForcedUnwind going through a non-empty exception specification
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 11.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-22 01:25 UTC by Fangrui Song
Modified: 2021-01-22 13:28 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fangrui Song 2021-01-22 01:25:18 UTC
gcc/testsuite/g++.dg/eh/forced3.C says forced unwinding calls std::unexpected going through a throw() function.

gcc/testsuite/g++.dg/eh/forced4.C says forced unwinding does not call std::unexpected going through a throw(int) function.

The behavior looks strange: if we consider forced unwinding a special exception type, both throw() and throw(int) should catch it.


Note: for nothrow, GCC emits minimum amount of .gcc_except_table section. forced unwinding calls std::terminate.
Comment 1 Jonathan Wakely 2021-01-22 11:47:13 UTC
(In reply to Fangrui Song from comment #0)
> The behavior looks strange: if we consider forced unwinding a special
> exception type, both throw() and throw(int) should catch it.


It's not strange if you consider throw() to be noexcept(true) and throw(int) as similar to noexcept(false).
Comment 2 Jonathan Wakely 2021-01-22 13:28:59 UTC
FWIW I think this belongs to the libgcc or c++ components, as _Unwind_ForcedUnwind is not defined in libstdc++.