delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2015/03/25/18:12:02

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:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type:content-transfer-encoding;
q=dns; s=default; b=Lc1krVESX99rrI4ZRxa2Ymp6PfnFSqBiP3523XVe/RI
bR46MSSj5dClTFOK1W5xVUp9rXr+Zi8EQeN/OwsSceYuOqQfV1nq3rYezoxW+gVc
WAxCSf9iLM9W2xlGnOe7bpVVn7lXTRRrhP/Iqmsw+0pcY2LYZ46LfPXQJr+IWYis
=
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:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type:content-transfer-encoding;
s=default; bh=4LW9zZgh7ikikiARJMnpCNzkgGU=; b=Hc31/YG8DrPCoat5i
XmLuIp7LfFLNXtqUoYoT+yuddLBIm6eN2bBJqoAXS/Qss15nh0ScQ/SX3QcpWdfz
6RoOkw+j8GuovhDTPPaVQBLoRYt4LS+Z9ErjrURmgmIETfAWhqFD1FucV2ILRZdb
PJlugJmn1xgSEU0tMZkC/rP3vw=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
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: 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
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: A2CWAQASMhNV/wVe0lUNT4QygxLHdAMCAoInAQEBAQEBhREBAQEDASMPAQVABgsLGAICBRYLAgIJAwIBAgFFEwYCAQGII68bcJoiAQEBBwEBAQEBAQEbgSGKAIR9FoJSgUUFjkKIIYR3j0qDR4IkHIFQb4JDAQEB
X-IPAS-Result: A2CWAQASMhNV/wVe0lUNT4QygxLHdAMCAoInAQEBAQEBhREBAQEDASMPAQVABgsLGAICBRYLAgIJAwIBAgFFEwYCAQGII68bcJoiAQEBBwEBAQEBAQEbgSGKAIR9FoJSgUUFjkKIIYR3j0qDR4IkHIFQb4JDAQEB
Message-ID: <55133295.1090105@tiscali.co.uk>
Date: Wed, 25 Mar 2015 22:11:33 +0000
From: David Stacey <drstacey AT tiscali DOT co DOT uk>
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 AT cygwin DOT com
Subject: Re: static vs. shared linking
References: <5510A9AB DOT 7020607 AT tiscali DOT co DOT uk> <5511AF73 DOT 9070607 AT tiscali DOT co DOT uk> <20150325090453 DOT GB3017 AT calimero DOT vinschen DOT de> <850E2E37-EA86-448E-9B9F-206C662E14E5 AT etr-usa DOT com>
In-Reply-To: <850E2E37-EA86-448E-9B9F-206C662E14E5@etr-usa.com>
X-IsSubscribed: yes

On 25/03/2015 16:59, Warren Young wrote:
> On Mar 25, 2015, at 3:04 AM, Corinna Vinschen<corinna-cygwin AT cygwin DOT com>  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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019