public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Cc: Ryan Johnson <ryan.johnson@cs.utoronto.ca>
Subject: Re: Destructors not called for c++11 thread_local objects
Date: Fri, 01 Aug 2014 18:17:00 -0000	[thread overview]
Message-ID: <20140801181714.GI25860@calimero.vinschen.de> (raw)
In-Reply-To: <53DBD151.90308@cygwin.com>

[-- Attachment #1: Type: text/plain, Size: 1599 bytes --]

On Aug  1 13:41, Larry Hall (Cygwin) wrote:
> On 08/01/2014 01:32 PM, Ryan Johnson wrote:
> >Hi all,
> >
> >(Please CC me in replies, I'm not subscribed to the list)
> >
> >Question: is this a Cygwin bug, gcc bug, or somebody else's bug entirely?
> >
> >The following STC shows the problem:
> >
> >$ cat bug.cpp
> >#include <cstdio>
> >static thread_local struct X {
> >     int x;
> >     X() { puts("hi"); }
> >     ~X() { puts("bye!"); }
> >} x;
> >int main() { x.x = 0; }
> >
> >$ g++ -std=gnu++11 -Wall -g bug.cpp && ./a
> >hi
> >
> >A quick inspection of the assembly code shows no call to __cxa_thread_atexit
> >in __tls_init, where the same code compiled on linux, with the same version
> >of gcc, has it right. This is odd, because the function does seem to be
> >available in cygwin's libstdc++:
> >
> >$ nm /usr/lib/gcc/x86_64-pc-cygwin/4.8.3/libstdc++.a | grep thread_atexit
> >0000000000000000 d .data$_ZZ19__cxa_thread_atexitE4once
> >0000000000000000 p .pdata$__cxa_thread_atexit
> >0000000000000000 t .text$__cxa_thread_atexit
> >0000000000000000 r .xdata$__cxa_thread_atexit
> >0000000000000000 T __cxa_thread_atexit
> >0000000000000000 d _ZZ19__cxa_thread_atexitE4once
> >[...]
> 
> Well it's not a general gcc problem because the same code on Linux with
> version 4.8.3 works for me.

It seems thread_local storage needs to be implemented in GCC for the
target, and it isn't.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

      reply	other threads:[~2014-08-01 18:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-01 17:33 Ryan Johnson
2014-08-01 17:42 ` Larry Hall (Cygwin)
2014-08-01 18:17   ` Corinna Vinschen [this message]

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=20140801181714.GI25860@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin@cygwin.com \
    --cc=ryan.johnson@cs.utoronto.ca \
    /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).