From: Jonathan Wakely <jwakely@redhat.com>
To: unlvsur unlvsur <unlvsur@live.com>
Cc: "unlvsur unlvsur via Libstdc++" <libstdc++@gcc.gnu.org>
Subject: Re: Question about __gnu_cxx::__exchange_and_add_dispatch
Date: Fri, 21 Apr 2023 09:49:07 +0100 [thread overview]
Message-ID: <CACb0b4=7U2_pQCDc=fe95WSXZWpN4ubKRxbNivFt+btbJv5Wfg@mail.gmail.com> (raw)
In-Reply-To: <DM6PR05MB46977BE72C0A74C18058A6C5D6609@DM6PR05MB4697.namprd05.prod.outlook.com>
On Fri, 21 Apr 2023 at 08:06, unlvsur unlvsur via Libstdc++
<libstdc++@gcc.gnu.org> wrote:
>
> Take this as an example
> gcc/ios_init.cc at master · gcc-mirror/gcc (github.com)<https://github.com/gcc-mirror/gcc/blob/master/libstdc++-v3/src/c++98/ios_init.cc#L80>
>
>
> what happens when
> if (__gnu_cxx::__exchange_and_add_dispatch(&_S_refcount, 1) != 0??
>
> Does that mean global objects of iostream are not initialized?)
If _S_refcount != 0 that means the global iostreams have already been
initialized.
> Probably this is why I get crashing on windows since never (__gnu_cxx::__exchange_and_add_dispatch(&_S_refcount, 1) == 0
> With win32 thread model any more
That _S_refcount object has static storage duration, so it should be
initialized to zero before the program starts executing.
If static data isn't being zeroed that yes, that will cause big problems.
> However, if I use lld or statically link with ld, the program would still work. It does not when it dynamic link with ld.
next prev parent reply other threads:[~2023-04-21 8:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-21 7:06 unlvsur unlvsur
2023-04-21 8:49 ` Jonathan Wakely [this message]
2023-04-21 8:53 ` unlvsur unlvsur
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='CACb0b4=7U2_pQCDc=fe95WSXZWpN4ubKRxbNivFt+btbJv5Wfg@mail.gmail.com' \
--to=jwakely@redhat.com \
--cc=libstdc++@gcc.gnu.org \
--cc=unlvsur@live.com \
/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).