public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/20099] New: -pthreads should imply -fno-threadsafe-statics
@ 2005-02-20 13:52 davids at webmaster dot com
  2005-02-20 14:17 ` [Bug c++/20099] " pinskia at gcc dot gnu dot org
                   ` (26 more replies)
  0 siblings, 27 replies; 28+ messages in thread
From: davids at webmaster dot com @ 2005-02-20 13:52 UTC (permalink / raw)
  To: gcc-bugs

The '-fno-threadsafe-statics' is purely a pessimization for POSIX pthreads code.
Since the POSIX standard already requires a mutex around operations that modify
data, and the C++ standard specifies lazy initialization, POSIX code will
already have mutexes to make static initialization thread safe. The code is,
therefore, already thread safe and cannot be made more so.

This option does allow non-compliant code to work by relaxing some of the
requirements in the POSIX standard. That's a good option to have, but it should
not be on by default. Code should, by default, get the benefit of the
optimizations the standard allows.

In summary, an option that is a pure pessimization for compliant code, and is
only required to make non-compliant code work, should not be on by default when
that standard is invoked. This is the case for other options in this category
(writable strings, relaxed aliasing, and so on).

So, '-pthreads' should imply '-fno-threadsafe-statics', and an option like
'-fthreadsafe-statics' should be created to request this option.

-- 
           Summary: -pthreads should imply -fno-threadsafe-statics
           Product: gcc
           Version: 3.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: davids at webmaster dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i386-redhat-linux
  GCC host triplet: i386-redhat-linux
GCC target triplet: i386-redhat-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20099


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

end of thread, other threads:[~2005-02-24 23:45 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-20 13:52 [Bug c++/20099] New: -pthreads should imply -fno-threadsafe-statics davids at webmaster dot com
2005-02-20 14:17 ` [Bug c++/20099] " pinskia at gcc dot gnu dot org
2005-02-20 14:18 ` davids at webmaster dot com
2005-02-20 14:18 ` pinskia at gcc dot gnu dot org
2005-02-20 14:22 ` pinskia at gcc dot gnu dot org
2005-02-20 15:07 ` davids at webmaster dot com
2005-02-20 15:11 ` davids at webmaster dot com
2005-02-20 15:37 ` pinskia at gcc dot gnu dot org
2005-02-20 17:07 ` qrczak at knm dot org dot pl
2005-02-20 17:15 ` davids at webmaster dot com
2005-02-20 18:12 ` qrczak at knm dot org dot pl
2005-02-21  9:29 ` davids at webmaster dot com
2005-02-21 12:04 ` qrczak at knm dot org dot pl
2005-02-21 15:45 ` gniccolai at yahoo dot com
2005-02-21 16:34 ` davids at webmaster dot com
2005-02-22 15:59 ` gniccolai at yahoo dot com
2005-02-23 11:55 ` davids at webmaster dot com
2005-02-23 11:57 ` qrczak at knm dot org dot pl
2005-02-23 12:26 ` pinskia at gcc dot gnu dot org
2005-02-23 12:28 ` davids at webmaster dot com
2005-02-24 15:28 ` gniccolai at yahoo dot com
2005-02-24 20:00 ` gniccolai at yahoo dot com
2005-02-24 22:02 ` qrczak at knm dot org dot pl
2005-02-25  1:37 ` davids at webmaster dot com
2005-02-25  1:41 ` qrczak at knm dot org dot pl
2005-02-25  3:30 ` davids at webmaster dot com
2005-02-25  4:37 ` qrczak at knm dot org dot pl
2005-02-25  8:06 ` davids at webmaster dot com

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).