From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 115715 invoked by alias); 25 Mar 2015 22:11:46 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 115706 invoked by uid 89); 25 Mar 2015 22:11:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: Yes, score=5.2 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,KAM_COUK,KAM_FROM_URIBL_PCCC,SPF_PASS autolearn=no version=3.3.2 X-HELO: out.ipsmtp2nec.opaltelecom.net Received: from out.ipsmtp2nec.opaltelecom.net (HELO out.ipsmtp2nec.opaltelecom.net) (62.24.202.74) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Wed, 25 Mar 2015 22:11:43 +0000 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2CWAQASMhNV/wVe0lUNT4QygxLHdAMCAoInAQEBAQEBhREBAQEDASMPAQVABgsLGAICBRYLAgIJAwIBAgFFEwYCAQGII68bcJoiAQEBBwEBAQEBAQEbgSGKAIR9FoJSgUUFjkKIIYR3j0qDR4IkHIFQb4JDAQEB X-IPAS-Result: A2CWAQASMhNV/wVe0lUNT4QygxLHdAMCAoInAQEBAQEBhREBAQEDASMPAQVABgsLGAICBRYLAgIJAwIBAgFFEwYCAQGII68bcJoiAQEBBwEBAQEBAQEbgSGKAIR9FoJSgUUFjkKIIYR3j0qDR4IkHIFQb4JDAQEB Received: from 85-210-94-5.dynamic.dsl.as9105.com (HELO [127.0.0.1]) ([85.210.94.5]) by out.ipsmtp2nec.opaltelecom.net with ESMTP; 25 Mar 2015 22:11:39 +0000 Message-ID: <55133295.1090105@tiscali.co.uk> Date: Wed, 25 Mar 2015 22:42:00 -0000 From: David Stacey User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: cygwin@cygwin.com Subject: Re: static vs. shared linking References: <5510A9AB.7020607@tiscali.co.uk> <5511AF73.9070607@tiscali.co.uk> <20150325090453.GB3017@calimero.vinschen.de> <850E2E37-EA86-448E-9B9F-206C662E14E5@etr-usa.com> In-Reply-To: <850E2E37-EA86-448E-9B9F-206C662E14E5@etr-usa.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2015-03/txt/msg00459.txt.bz2 On 25/03/2015 16:59, Warren Young wrote: > On Mar 25, 2015, at 3:04 AM, Corinna Vinschen wrote: >> >> And this is where it comes from. It's a call to >> >> void basic_string<_CharT, _Traits, _Alloc>::reserve(size_type __res) > David, what happens if you say > > wtext.reserve(1); > > inside runTests() before the call to crash()? > > If that makes the symptom disappear, I wonder if there’s some problem with a Cygwin *.exe owning a std::string that gets resized by a Cygwin *.dll. If so, that probably*is* a memory ownership coordination problem that affects Cygwin proper. Thank you for taking the time to look at this. You are quite correct. When I reserve() space on the string in runTests() then the problem goes away. In order to test your hypothesis about memory ownership, I'll create a test that malloc(3)s some memory in the .exe and free(3)s it in a shared library; Corinna showed that the crash was coming from an abort() in free(). However, I can't believe it's that simple - you'd think there would be dozens of programmes crashing for this reason. > I’ve run both versions under valgrind on a Linux box here, and they can find no fault with your code. Thanks. Obviously, when coming across problems like this, my first thought is that I've managed to do something silly. But if neither you, me nor Corinna can spot an obvious blunder then that opens the possibility that there's something fruity going on. > On manual inspection, I, too find it to be perfectly cromulent. Personally, I was thoroughly discombobulated. Dave. -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple