On 09/25/2017 06:33 PM, Steven Penny wrote: > On Mon, 25 Sep 2017 14:17:28, JonY wrote: >> You can actually use Cygwin gdb to debug and see what went wrong, >> assuming the debug symbols are around. >> >> Sorry if I'm not much help, kind of busy these days. > > New command: > > x86_64-w64-mingw32-g++ -g -static -o z z.cpp > > Output: > > (gdb) run > Starting program: /tmp/z [New Thread 5956.0xfe4] > Program received signal SIGSEGV, Segmentation fault. > std::ostream::sentry::sentry (this=this@entry=0x22fd90, __os=...) >  at /cygdrive/i/szsz/tmpp/cygwin64/mingw64-x86_64/ >  mingw64-x86_64-gcc-6.3.0-1.x86_64/src/gcc-6.3.0/libstdc++-v3/include/bits/ >  ostream.tcc:51 > 51 /cygdrive/i/szsz/tmpp/cygwin64/mingw64-x86_64/ >  mingw64-x86_64-gcc-6.3.0-1.x86_64/src/gcc-6.3.0/libstdc++-v3/include/bits/ >  ostream.tcc: No such file or directory. > (gdb) backtrace > #0  std::ostream::sentry::sentry (this=this@entry=0x22fd90, __os=...) >    at /cygdrive/i/szsz/tmpp/cygwin64/mingw64-x86_64/ >    > mingw64-x86_64-gcc-6.3.0-1.x86_64/src/gcc-6.3.0/libstdc++-v3/include/bits/ >    ostream.tcc:51 > #1  0x000000000049ece9 in std::__ostream_insert std::char_traits > >  (__out=...,  __s=__s@entry=0x4ab031 "cout > test\n", __n=10) >  at /cygdrive/i/szsz/tmpp/cygwin64/mingw64-x86_64/ >  mingw64-x86_64-gcc-6.3.0-1.x86_64/src/gcc-6.3.0/libstdc++-v3/include/bits/ >  ostream_insert.h:82 > #2  0x00000000004a3547 in std::operator<< > ( >  __out=..., __s=0x4ab031 "cout test\n") >  at /cygdrive/i/szsz/tmpp/cygwin64/mingw64-x86_64/ >  mingw64-x86_64-gcc-6.3.0-1.x86_64/src/gcc-6.3.0/libstdc++-v3/include/std/ >  ostream:561 > #3  0x00000000004015e0 in main () at z.cpp:3 > Looks like the ostream is not properly initialized, all the C++ constructors involved makes it even more messy to debug.