X-Spam-Check-By: sourceware.org To: cygwin AT cygwin DOT com From: Steven Brown Subject: Reproducible, simple bug; g++ toolchain / std::string bug? Date: Fri, 07 Apr 2006 17:34:09 -0700 Lines: 86 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------010208010209000003050604" User-Agent: Thunderbird 1.5 (Windows/20051201) X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm 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 --------------010208010209000003050604 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit I've run into what appears to be a bug in the g++ toolchain or the STL's std::string using the latest Cygwin dist (up to date as of right now). Minimal test case attached. If my shared library does a callback to a function returning std::string, and only if the std::string is empty, I get an abort when that std::string is destroyed. The attached files will show this bug - run make and the xxx-cygwin.exe that's produced and it will abort. The same will happen if you use libtool to build it the right way - the autoconf/ dir in the bug's repository[1] can be used for that if you want to see it (copy it into the main dir, ./autogen.sh && make). Any ideas as to where the problem lies or how to further identify it? [1] https://svn.variadic.org/public/trunk/weirdbug/ --------------010208010209000003050604 Content-Type: text/plain; name="Makefile" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="Makefile" all: xxx-cygwin xxx-cygwin: testit.cc xxx.cc g++ -g -O2 -shared testit.cc -o testit-cygwin.dll && g++ -g -O2 xxx.cc testit-cygwin.dll -o xxx-cygwin.exe clean: rm -f testit-cygwin.dll xxx-cygwin.exe --------------010208010209000003050604 Content-Type: text/plain; name="testit.cc" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="testit.cc" #include "testit.hpp" #include using namespace std; void testit(std::string (*contentGet)()) { contentGet(); } --------------010208010209000003050604 Content-Type: text/plain; name="testit.hpp" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="testit.hpp" #include void testit(std::string (*contentGet)()); --------------010208010209000003050604 Content-Type: text/plain; name="xxx.cc" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="xxx.cc" #include "testit.hpp" #include using namespace std; std::string contentGet() { return string(""); // Anything other than empty string works. } int main() { testit(&contentGet); return 0; } --------------010208010209000003050604 Content-Type: text/plain; charset=us-ascii -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ --------------010208010209000003050604--