public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/112089] New: std::shared_lock::unlock should throw operation_not_permitted instead resource_deadlock_would_occur
@ 2023-10-25 21:16 d at ilvokhin dot com
2023-10-25 21:32 ` [Bug libstdc++/112089] " redi at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: d at ilvokhin dot com @ 2023-10-25 21:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112089
Bug ID: 112089
Summary: std::shared_lock::unlock should throw
operation_not_permitted instead
resource_deadlock_would_occur
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: d at ilvokhin dot com
Target Milestone: ---
Based on C++ standard wording, when we call unlock and don't own anything we
should throw operation_not_permitted. Sec 33.6.5.5.3 from here
(https://eel.is/c++draft/thread.lock.shared.locking#25.1):
> void unlock();
> <...>
> Error conditions:
> operation_not_permitted — if on entry owns is false.
But current implementation throws resource_deadlock_would_occur instead:
https://github.com/gcc-mirror/gcc/blob/458db9b6149b2e9bef94ab76909eb914ed9f675a/libstdc%2B%2B-v3/include/std/shared_mutex#L823
It doesn't change much, just a little inconsistency.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/112089] std::shared_lock::unlock should throw operation_not_permitted instead resource_deadlock_would_occur
2023-10-25 21:16 [Bug libstdc++/112089] New: std::shared_lock::unlock should throw operation_not_permitted instead resource_deadlock_would_occur d at ilvokhin dot com
@ 2023-10-25 21:32 ` redi at gcc dot gnu.org
2023-10-26 20:11 ` cvs-commit at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2023-10-25 21:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112089
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2023-10-25
Ever confirmed|0 |1
Status|UNCONFIRMED |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |redi at gcc dot gnu.org
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Good catch, thanks! I think I probably just copy&pasted the throw from one of
the locking functions, which throw resource_deadlock_would_occur if _M_owns is
true, and forgot to change the error code.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/112089] std::shared_lock::unlock should throw operation_not_permitted instead resource_deadlock_would_occur
2023-10-25 21:16 [Bug libstdc++/112089] New: std::shared_lock::unlock should throw operation_not_permitted instead resource_deadlock_would_occur d at ilvokhin dot com
2023-10-25 21:32 ` [Bug libstdc++/112089] " redi at gcc dot gnu.org
@ 2023-10-26 20:11 ` cvs-commit at gcc dot gnu.org
2023-10-26 20:36 ` redi at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-10-26 20:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112089
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:
https://gcc.gnu.org/g:0c305f3dec9a992dd775a3b9607b7b1e8c051859
commit r14-4960-g0c305f3dec9a992dd775a3b9607b7b1e8c051859
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Thu Oct 26 16:51:30 2023 +0100
libstdc++: Fix exception thrown by std::shared_lock::unlock() [PR112089]
The incorrect errc constant here looks like a copy&paste error.
libstdc++-v3/ChangeLog:
PR libstdc++/112089
* include/std/shared_mutex (shared_lock::unlock): Change errc
constant to operation_not_permitted.
* testsuite/30_threads/shared_lock/locking/112089.cc: New test.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/112089] std::shared_lock::unlock should throw operation_not_permitted instead resource_deadlock_would_occur
2023-10-25 21:16 [Bug libstdc++/112089] New: std::shared_lock::unlock should throw operation_not_permitted instead resource_deadlock_would_occur d at ilvokhin dot com
2023-10-25 21:32 ` [Bug libstdc++/112089] " redi at gcc dot gnu.org
2023-10-26 20:11 ` cvs-commit at gcc dot gnu.org
@ 2023-10-26 20:36 ` redi at gcc dot gnu.org
2023-11-08 13:18 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2023-10-26 20:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112089
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |11.5
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed on trunk so far.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/112089] std::shared_lock::unlock should throw operation_not_permitted instead resource_deadlock_would_occur
2023-10-25 21:16 [Bug libstdc++/112089] New: std::shared_lock::unlock should throw operation_not_permitted instead resource_deadlock_would_occur d at ilvokhin dot com
` (2 preceding siblings ...)
2023-10-26 20:36 ` redi at gcc dot gnu.org
@ 2023-11-08 13:18 ` cvs-commit at gcc dot gnu.org
2024-03-18 14:06 ` cvs-commit at gcc dot gnu.org
2024-03-18 14:14 ` redi at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-11-08 13:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112089
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:
https://gcc.gnu.org/g:e46a07b0e8a2bb074b491e0bb54a5cc8c8051341
commit r13-8012-ge46a07b0e8a2bb074b491e0bb54a5cc8c8051341
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Thu Oct 26 16:51:30 2023 +0100
libstdc++: Fix exception thrown by std::shared_lock::unlock() [PR112089]
The incorrect errc constant here looks like a copy&paste error.
libstdc++-v3/ChangeLog:
PR libstdc++/112089
* include/std/shared_mutex (shared_lock::unlock): Change errc
constant to operation_not_permitted.
* testsuite/30_threads/shared_lock/locking/112089.cc: New test.
(cherry picked from commit 0c305f3dec9a992dd775a3b9607b7b1e8c051859)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/112089] std::shared_lock::unlock should throw operation_not_permitted instead resource_deadlock_would_occur
2023-10-25 21:16 [Bug libstdc++/112089] New: std::shared_lock::unlock should throw operation_not_permitted instead resource_deadlock_would_occur d at ilvokhin dot com
` (3 preceding siblings ...)
2023-11-08 13:18 ` cvs-commit at gcc dot gnu.org
@ 2024-03-18 14:06 ` cvs-commit at gcc dot gnu.org
2024-03-18 14:14 ` redi at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-03-18 14:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112089
--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:
https://gcc.gnu.org/g:c285c1b9a940bde745f296e1bfc1a5cfddb63254
commit r12-10252-gc285c1b9a940bde745f296e1bfc1a5cfddb63254
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Thu Oct 26 16:51:30 2023 +0100
libstdc++: Fix exception thrown by std::shared_lock::unlock() [PR112089]
The incorrect errc constant here looks like a copy&paste error.
libstdc++-v3/ChangeLog:
PR libstdc++/112089
* include/std/shared_mutex (shared_lock::unlock): Change errc
constant to operation_not_permitted.
* testsuite/30_threads/shared_lock/locking/112089.cc: New test.
(cherry picked from commit 0c305f3dec9a992dd775a3b9607b7b1e8c051859)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/112089] std::shared_lock::unlock should throw operation_not_permitted instead resource_deadlock_would_occur
2023-10-25 21:16 [Bug libstdc++/112089] New: std::shared_lock::unlock should throw operation_not_permitted instead resource_deadlock_would_occur d at ilvokhin dot com
` (4 preceding siblings ...)
2024-03-18 14:06 ` cvs-commit at gcc dot gnu.org
@ 2024-03-18 14:14 ` redi at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2024-03-18 14:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112089
--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Backported for 13.3 and 12.4
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-03-18 14:14 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-25 21:16 [Bug libstdc++/112089] New: std::shared_lock::unlock should throw operation_not_permitted instead resource_deadlock_would_occur d at ilvokhin dot com
2023-10-25 21:32 ` [Bug libstdc++/112089] " redi at gcc dot gnu.org
2023-10-26 20:11 ` cvs-commit at gcc dot gnu.org
2023-10-26 20:36 ` redi at gcc dot gnu.org
2023-11-08 13:18 ` cvs-commit at gcc dot gnu.org
2024-03-18 14:06 ` cvs-commit at gcc dot gnu.org
2024-03-18 14:14 ` redi at gcc dot gnu.org
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).