This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/20099] -pthreads should imply -fno-threadsafe-statics
- From: "qrczak at knm dot org dot pl" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Feb 2005 21:06:42 -0000
- Subject: [Bug c++/20099] -pthreads should imply -fno-threadsafe-statics
- References: <20050220004607.20099.davids@webmaster.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From qrczak at knm dot org dot pl 2005-02-24 21:06 -------
> First, if we're talking about pthreads programs, which is the only case I'm
> suggesting removing the locking for, then those programs are already broken.
They are non-portable no matter how static initializers are done: C++ doesn't
include threads and POSIX doesn't include C++.
> If GCC/G++ are going to have non-portable features that make code work
> when they're enabled and break when they're disabled, they definitely
> should not be on by default.
Taking portability aside (as they are already non-portable), this is a wonderful
quote when taken out of context. Yeah, if an option makes more code working and
its negation makes more code break, let's make the breaking variant the default :-)
> (Or are you seriously arguing that the C++ standard and the
> POSIX standard *require* this behavior?)
Of course not. Not yet anyhow.
For me static locals in C++ are the equivalent of pthread_once in C/POSIX. A
hypothetical C++/POSIX should make them MT-safe.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20099