public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/52681] New: [C++11] Using std::thread without -pthread crashes without warning
@ 2012-03-23 2:08 mkline at cs dot wisc.edu
2012-03-23 12:44 ` [Bug libstdc++/52681] " redi at gcc dot gnu.org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: mkline at cs dot wisc.edu @ 2012-03-23 2:08 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52681
Bug #: 52681
Summary: [C++11] Using std::thread without -pthread crashes
without warning
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: libstdc++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: mkline@cs.wisc.edu
Without -pthread, the constructor of std::thread always throws
std::system_error. While this was apparently the resolution to bug 42198,
simply throwing an error with the code 'operation_not_permitted' is rather
mystifying to someone who isn't aware of the problem in the first place.
Would it be possible to offer a more descriptive error, preferably at compile
time?
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug libstdc++/52681] [C++11] Using std::thread without -pthread crashes without warning
2012-03-23 2:08 [Bug libstdc++/52681] New: [C++11] Using std::thread without -pthread crashes without warning mkline at cs dot wisc.edu
@ 2012-03-23 12:44 ` redi at gcc dot gnu.org
2012-03-23 13:20 ` mkline at cs dot wisc.edu
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2012-03-23 12:44 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52681
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|minor |enhancement
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-03-23 12:31:38 UTC ---
The problem is that not all targets need -pthread, or some which do need it
spell it differently, and not all platforms define _REENTRANT when the option
is used, so there's no reliable way to do what you're asking for.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug libstdc++/52681] [C++11] Using std::thread without -pthread crashes without warning
2012-03-23 2:08 [Bug libstdc++/52681] New: [C++11] Using std::thread without -pthread crashes without warning mkline at cs dot wisc.edu
2012-03-23 12:44 ` [Bug libstdc++/52681] " redi at gcc dot gnu.org
@ 2012-03-23 13:20 ` mkline at cs dot wisc.edu
2012-03-23 13:36 ` paolo.carlini at oracle dot com
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: mkline at cs dot wisc.edu @ 2012-03-23 13:20 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52681
--- Comment #2 from Matt Kline <mkline at cs dot wisc.edu> 2012-03-23 13:16:23 UTC ---
Would it be possible to at least make the exception that is being thrown more
descriptive? I had guessed that some kind of compile-time warning might be
impossible, but my main concern is that the exception that gets thrown offers
little insight on what the problem might be.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug libstdc++/52681] [C++11] Using std::thread without -pthread crashes without warning
2012-03-23 2:08 [Bug libstdc++/52681] New: [C++11] Using std::thread without -pthread crashes without warning mkline at cs dot wisc.edu
2012-03-23 12:44 ` [Bug libstdc++/52681] " redi at gcc dot gnu.org
2012-03-23 13:20 ` mkline at cs dot wisc.edu
@ 2012-03-23 13:36 ` paolo.carlini at oracle dot com
2012-04-18 10:07 ` redi at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-03-23 13:36 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52681
--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-03-23 13:29:38 UTC ---
Probably, something in the docs could be also useful.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug libstdc++/52681] [C++11] Using std::thread without -pthread crashes without warning
2012-03-23 2:08 [Bug libstdc++/52681] New: [C++11] Using std::thread without -pthread crashes without warning mkline at cs dot wisc.edu
` (2 preceding siblings ...)
2012-03-23 13:36 ` paolo.carlini at oracle dot com
@ 2012-04-18 10:07 ` redi at gcc dot gnu.org
2012-04-18 14:06 ` mkline at cs dot wisc.edu
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2012-04-18 10:07 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52681
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2012-04-18
AssignedTo|unassigned at gcc dot |redi at gcc dot gnu.org
|gnu.org |
Ever Confirmed|0 |1
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-04-18 10:05:43 UTC ---
We could fix this just by overloading __throw_system_error to take a string:
__throw_system_error(int(errc::operation_not_permitted),
"Enable multithreading support to use std::thread");
then passing that to the std::system_error constructor.
That would give something like:
terminate called after throwing an instance of 'std::system_error'
what(): Enable multithreading support to use std::thread: Operation not
permitted
Aborted (core dumped)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug libstdc++/52681] [C++11] Using std::thread without -pthread crashes without warning
2012-03-23 2:08 [Bug libstdc++/52681] New: [C++11] Using std::thread without -pthread crashes without warning mkline at cs dot wisc.edu
` (3 preceding siblings ...)
2012-04-18 10:07 ` redi at gcc dot gnu.org
@ 2012-04-18 14:06 ` mkline at cs dot wisc.edu
2012-04-18 14:28 ` redi at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: mkline at cs dot wisc.edu @ 2012-04-18 14:06 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52681
--- Comment #5 from Matt Kline <mkline at cs dot wisc.edu> 2012-04-18 14:04:37 UTC ---
That, if feasible, would be perfect.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug libstdc++/52681] [C++11] Using std::thread without -pthread crashes without warning
2012-03-23 2:08 [Bug libstdc++/52681] New: [C++11] Using std::thread without -pthread crashes without warning mkline at cs dot wisc.edu
` (4 preceding siblings ...)
2012-04-18 14:06 ` mkline at cs dot wisc.edu
@ 2012-04-18 14:28 ` redi at gcc dot gnu.org
2012-08-12 18:58 ` redi at gcc dot gnu.org
2012-08-12 19:03 ` redi at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2012-04-18 14:28 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52681
--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-04-18 14:16:20 UTC ---
Entirely feasible, and probably safe enough for the 4.6 and 4.7 branches too.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug libstdc++/52681] [C++11] Using std::thread without -pthread crashes without warning
2012-03-23 2:08 [Bug libstdc++/52681] New: [C++11] Using std::thread without -pthread crashes without warning mkline at cs dot wisc.edu
` (5 preceding siblings ...)
2012-04-18 14:28 ` redi at gcc dot gnu.org
@ 2012-08-12 18:58 ` redi at gcc dot gnu.org
2012-08-12 19:03 ` redi at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2012-08-12 18:58 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52681
--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-08-12 18:57:58 UTC ---
Author: redi
Date: Sun Aug 12 18:57:53 2012
New Revision: 190330
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=190330
Log:
PR libstdc++/52681
* src/c++11/thread.cc (thread::_M_start_thread): Improve error text
when threads are not enabled.
Modified:
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/src/c++11/thread.cc
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug libstdc++/52681] [C++11] Using std::thread without -pthread crashes without warning
2012-03-23 2:08 [Bug libstdc++/52681] New: [C++11] Using std::thread without -pthread crashes without warning mkline at cs dot wisc.edu
` (6 preceding siblings ...)
2012-08-12 18:58 ` redi at gcc dot gnu.org
@ 2012-08-12 19:03 ` redi at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2012-08-12 19:03 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52681
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.8.0
--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-08-12 19:02:45 UTC ---
fixed for 4.8
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2012-08-12 19:03 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-23 2:08 [Bug libstdc++/52681] New: [C++11] Using std::thread without -pthread crashes without warning mkline at cs dot wisc.edu
2012-03-23 12:44 ` [Bug libstdc++/52681] " redi at gcc dot gnu.org
2012-03-23 13:20 ` mkline at cs dot wisc.edu
2012-03-23 13:36 ` paolo.carlini at oracle dot com
2012-04-18 10:07 ` redi at gcc dot gnu.org
2012-04-18 14:06 ` mkline at cs dot wisc.edu
2012-04-18 14:28 ` redi at gcc dot gnu.org
2012-08-12 18:58 ` redi at gcc dot gnu.org
2012-08-12 19:03 ` 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).