X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:cc:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; q=dns; s= default; b=Zvi845uHOEQviGgKRp8M3qhBgNt6lCmRZxLb5gA5dZOuxTl2/+izn VxddvVsKte3wKW1vitUTd/e36ckZAHP5j1E3kBpXdhEq6LlTv+3OZzCfv9vugnx7 QccVnEpLWpMr5VUlw2TqMl6zzVhOR2Yl83CjH3ZhGJsygUGq356HZI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:cc:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; s=default; bh=uC6OCyoRYCgKkpqkPcjiOsQQP0g=; b=AWYtBFoe26TcRREA0eJrql4q0XUd GcC10cpwUMObNuuIGE8/j0TpJFswnwwEqC0bYZr6CCfxh5L6EdWMxaU3QNBtdiOU cuPKT+cdK4H7Ry6EKTVD63p9bEsHqiK8rztvmKglkt4qX72949eYPEFmRnF7Pekj j+rv+48OWyGGEV4= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-5.9 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: calimero.vinschen.de Date: Fri, 1 Aug 2014 20:17:14 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Cc: Ryan Johnson Subject: Re: Destructors not called for c++11 thread_local objects Message-ID: <20140801181714.GI25860@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com, Ryan Johnson References: <53DBCF39 DOT 9050309 AT cs DOT utoronto DOT ca> <53DBD151 DOT 90308 AT cygwin DOT com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="9kBr9UDtZsI8nE8z" Content-Disposition: inline In-Reply-To: <53DBD151.90308@cygwin.com> User-Agent: Mutt/1.5.23 (2014-03-12) --9kBr9UDtZsI8nE8z Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 > >static thread_local struct X { > > int x; > > X() { puts("hi"); } > > ~X() { puts("bye!"); } > >} x; > >int main() { x.x =3D 0; } > > > >$ g++ -std=3Dgnu++11 -Wall -g bug.cpp && ./a > >hi > > > >A quick inspection of the assembly code shows no call to __cxa_thread_at= exit > >in __tls_init, where the same code compiled on linux, with the same vers= ion > >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 > >[...] >=20 > 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 --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --9kBr9UDtZsI8nE8z Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJT29mqAAoJEPU2Bp2uRE+gaOgQAIPRyJi5pQ7vGmPEi6BwdiYT ctgukP/9r/W+P9gpt/pUDtJLMQUefsMY/u5DPEj91MpbXdLEFJJL+ddbsYXGhLgV 1VwbSymHwEk93Or/WRR701sAxMZE/ICeuJpLXaIhSyOQ3dJBeT6l0j38LeWNJBxN emiWNxsxYHXQ+D8fFB5vxgUaNmfzlrFgK8G18utSaUxCnpJ0wwiXfz6LLJHDJ+xg E4x//PrxZpmbdGIkMGO3GNvorV2KrzlGRJLgBBbXS6N/dx3P5WQN3tMKbFYtVWSK tqk8r1BScCtmew/sP+QiBiOfHbe51x1cMKsZmsSgAfTE4F+D6dEi3XUGjRnHUqb2 MHvlQgAoidnHE8R+eijwZW1NEKaTe9ccPHE02KO1A8mGV2oFtHLCUZ7lIZPUGOaG jvomDz9wZmyskxHbVS96g/sJXd+WZhbzTwZyQPD/teseQM9yQNOufwF3Y51SenRb NhIvVgg2rWghoLelnEnkF5lcWoT+xUim8c4OLF6HexBfFJ7d/fhd6DHi8fnTufD8 t6ZGCfyX+drLYb4cTA2sCdnAY707zksaVOnmWj+o0S9fUFivJ3p+rwSS/N1fgKb5 /yZJ6ZRveBHNR8DACygVyN0LCF+x77qVWxwAyxjvO4gZ7BnkqeSFbkyZmZXr+hZK ZmkVsQvP3Ds7wn6KjkSl =BIOz -----END PGP SIGNATURE----- --9kBr9UDtZsI8nE8z--