This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Reproducible, simple bug; g++ toolchain / std::string bug?


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/
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
#include "testit.hpp"
#include <iostream>
using namespace std;

void testit(std::string (*contentGet)()) {
  contentGet();
}
#include <string>

void testit(std::string (*contentGet)());
#include "testit.hpp"
#include <iostream>
using namespace std;

std::string contentGet() {
  return string(""); // Anything other than empty string works.
}

int main() {
  testit(&contentGet);
  return 0;
}

--
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/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]