public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "vincenzo.innocente at cern dot ch" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/53785] coalescing multiple static instances in function scope
Date: Thu, 28 Jun 2012 04:43:00 -0000	[thread overview]
Message-ID: <bug-53785-4-rTB6ZaLdh7@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-53785-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #2 from vincenzo Innocente <vincenzo.innocente at cern dot ch> 2012-06-28 04:43:27 UTC ---
I think that no one can rely on the way statics are initialized to tune side
effects.
The only things to guarantee are that is guarded and, I think, that the order
is preserved (because of possible side effects). in case getId is inlined even
the order can be optimized in my opinion...

Now one can have race conditions, so getId could actually be called by
different threads in a unpredictable way. With a single gard it will become a
unique critical section (or a sort of transactional memory block).
Maybe experts in initialization in multi-threaded environments shall comment
further...


  parent reply	other threads:[~2012-06-28  4:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-27  6:49 [Bug rtl-optimization/53785] New: " vincenzo.innocente at cern dot ch
2012-06-27  6:59 ` [Bug rtl-optimization/53785] " pinskia at gcc dot gnu.org
2012-06-28  4:43 ` vincenzo.innocente at cern dot ch [this message]
2024-03-17  0:02 ` [Bug c++/53785] " pinskia at gcc dot gnu.org
2024-03-17  0:03 ` pinskia at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-53785-4-rTB6ZaLdh7@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).