public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/66172] New: -fno-threadsafe-statics suppresses guard functions but not guard variables
@ 2015-05-16  5:37 eleventen at gmail dot com
  2015-05-16  5:59 ` [Bug c++/66172] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: eleventen at gmail dot com @ 2015-05-16  5:37 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66172

            Bug ID: 66172
           Summary: -fno-threadsafe-statics suppresses guard functions but
                    not guard variables
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: eleventen at gmail dot com
  Target Milestone: ---

The use of the -fno-threadsafe-statics eliminates the function references to
the guard functions,

__cxa_guard_acquire
__cxa_guard_release


but it doesn't eliminate the variables used to guard the initialization.  A
compiled version of the attached file using the g++ command line therein
generated no references to the guard functions, but the guard variable remains.

# nm -C guard | grep guard
0000000000600a88 b guard variable for f()::a

--- Comment #1 from Marc Singer <eleventen at gmail dot com> ---
I neglected to include the version information:

# g++ --version
g++ (Debian 4.9.2-10) 4.9.2


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

* [Bug c++/66172] -fno-threadsafe-statics suppresses guard functions but not guard variables
  2015-05-16  5:37 [Bug c++/66172] New: -fno-threadsafe-statics suppresses guard functions but not guard variables eleventen at gmail dot com
@ 2015-05-16  5:59 ` pinskia at gcc dot gnu.org
  2015-05-16  6:06 ` eleventen at gmail dot com
  2015-05-16  6:11 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2015-05-16  5:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66172

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
You need the variable even without thread safe ones because calling the
function twice means it gets initlized only once rather twice. There is no
other way around this because the variable only gets initialized if the
function is called.


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

* [Bug c++/66172] -fno-threadsafe-statics suppresses guard functions but not guard variables
  2015-05-16  5:37 [Bug c++/66172] New: -fno-threadsafe-statics suppresses guard functions but not guard variables eleventen at gmail dot com
  2015-05-16  5:59 ` [Bug c++/66172] " pinskia at gcc dot gnu.org
@ 2015-05-16  6:06 ` eleventen at gmail dot com
  2015-05-16  6:11 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: eleventen at gmail dot com @ 2015-05-16  6:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66172

--- Comment #3 from Marc Singer <eleventen at gmail dot com> ---
I've come to the same conclusion.  My hope was that I could eliminate the guard
and force the compiler to initialize block scoped statics at the start of
execution.  It looks like the standard stands in the way of this
simplification.


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

* [Bug c++/66172] -fno-threadsafe-statics suppresses guard functions but not guard variables
  2015-05-16  5:37 [Bug c++/66172] New: -fno-threadsafe-statics suppresses guard functions but not guard variables eleventen at gmail dot com
  2015-05-16  5:59 ` [Bug c++/66172] " pinskia at gcc dot gnu.org
  2015-05-16  6:06 ` eleventen at gmail dot com
@ 2015-05-16  6:11 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2015-05-16  6:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66172

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 66173 has been marked as a duplicate of this bug. ***


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

end of thread, other threads:[~2015-05-16  6:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-16  5:37 [Bug c++/66172] New: -fno-threadsafe-statics suppresses guard functions but not guard variables eleventen at gmail dot com
2015-05-16  5:59 ` [Bug c++/66172] " pinskia at gcc dot gnu.org
2015-05-16  6:06 ` eleventen at gmail dot com
2015-05-16  6:11 ` pinskia 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).