lists.zerezo.com



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

***BOGO*** [Mingw-users] Test program crashes with g++ 4.2.1-dw2 using libstdc++_s



Hi,

I've been testing mingw-g++ 4.2.1-dw2 on Windows XP as non-admin user 
using the dynamic runtime libraries. I renamed g++-dw2.exe to g++.exe 
and gcc-dw2.exe to gcc.exe.

D:\Path with spaces\dev\workspace\test>g++ -v
Using built-in specs.
Target: mingw32
Configured with: ../gcc-4.2.1-2-src/configure --with-gcc 
--enable-libgomp --host
=mingw32 --build=mingw32 --target=mingw32 --program-suffix=-dw2 
--with-arch=i486
  --with-tune=generic --disable-werror --prefix=/mingw 
--with-local-prefix=/mingw
  --enable-threads --disable-nls 
--enable-languages=c,c++,fortran,objc,obj-c++,ad
a --disable-win32-registry --disable-sjlj-exceptions 
--enable-libstdcxx-debug --
enable-cxx-flags=-fno-function-sections -fno-data-sections 
--enable-version-spec
ific-runtime-libs --disable-bootstrap
Thread model: win32
gcc version 4.2.1-dw2 (mingw32-2)

I ran across the missing libgcc_s.a and solved this problem:
http://lists-archives.org/mingw-users/07776-g-4-2-1-with-shared-libstdc-not-catchingexceptions.html

D:\Path with spaces\mingw\bin>pexports libgcc_dw2_1.dll > libgcc_s.def
D:\Path with spaces\mingw\bin>dlltool -d libgcc_s.def -l libgcc_s.a 
libgcc_dw2_1.dll
D:\Path with spaces\dev\mingw\bin>move libgcc_s.a 
..\lib\gcc\mingw32\4.2.1-dw2\

Then I tested a simple hello world program main.cpp which uses iostreams:

--cut here--
#include <iostream>

using namespace std;

int
main()
{
	cout << "Test" << endl;
	return 0;
}
--cut here--

It compiles/links fine, but it crashes with -lstdc++_s.

D:\Path with spaces\dev\workspace\test>g++ -shared-libgcc main.cpp 
-lstdc++_s -o test

D:\Path with spaces\dev\workspace\test>test
(crash)
(I was asked to send a bug report to Microsoft which I did, but I 
suppose that won't help ;-) )

D:\Path with spaces\dev\workspace\test>gdb test
GNU gdb 6.8
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-mingw32"...
(gdb) run
Starting program: D:\Path with spaces\dev\workspace\test/test.exe
[New thread 3604.0xd80]

Program received signal SIGSEGV, Segmentation fault.
0x66453f5c in std::ostream::sentry::sentry ()
    from D:\Path with spaces\dev\workspace\test\libstdc++_dw2_6.dll
(gdb) bt
#0  0x66453f5c in std::ostream::sentry::sentry ()
    from D:\Path with spaces\dev\workspace\test\libstdc++_dw2_6.dll
#1  0x66470cfb in std::__ostream_insert<char, std::char_traits<char> > ()
    from D:\Path with spaces\dev\workspace\test\libstdc++_dw2_6.dll
#2  0x6647269e in std::operator<< <std::char_traits<char> > ()
    from D:\Path with spaces\dev\workspace\test\libstdc++_dw2_6.dll
#3  0x00401556 in main ()
(gdb)


Other variants work:

D:\Path with spaces\dev\workspace\test>g++ -shared-libgcc main.cpp -o test

D:\Path with spaces\dev\workspace\test>test
Test

D:\Path with spaces\dev\workspace\test>g++ main.cpp -o test

D:\Path with spaces\dev\workspace\test>test
Test

As the release notes state that version 3.13 of mingw-runtime is 
required, I retried using this version instead of 3.14, with the same 
result.

Any suggestions?

Best regards,

Lothar

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
MinGW-users mailing list
MinGW-users@xxxxxxxxxxxxxxxxxxxxx

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users