test framework / greg_month lexical cast segfault - is this fixed?

I'm trying to compile and run a very simple unit test using the boost test library on Windows with MinGW, and I'm running into a segfault problem. I searched around the issue, and it seems I've found references to such an issue from 2003: http://lists.boost.org/Archives/boost/2003/09/52920.php and there Jeff Garland says it's been fixed already. has it? I'm thinking it's the same issue based on this ticket: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11838 which points to the boost mailing list archive entry above. the test code is simply: #include <boost/test/unit_test.hpp> using namespace boost::unit_test; void test() { BOOST_CHECK(true); } test_suite * init_unit_test_suite(int, char **) { test_suite *ts = BOOST_TEST_SUITE("Test"); ts->add(BOOST_TEST_CASE(&test)); framework::master_test_suite().add(ts); return 0; } compiled with the following Makefile: CFLAGS=-I${INCLUDE_DIR} LDFLAGS=-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl,-subsystem,windows -L${LIB_DIR} test: test.o g++ ${LDFLAGS} test.o -lboost_unit_test_framework-mt -lboost_test_exec_monitor-mt -o test test.o: test.cpp g++ ${CFLAGS} -c -o test.o test.cpp and gdb says: Program received signal SIGSEGV, Segmentation fault. 0x00418e7c in global constructors keyed to _ZN5boost9unit_test64_GLOBAL__N_libs_ test_src_unit_test_monitor.cpp_3F6EE7DC_ED9224E217unit_test_monitorE () (gdb) bt #0 0x00418e7c in global constructors keyed to _ZN5boost9unit_test64_GLOBAL__N_l ibs_test_src_unit_test_monitor.cpp_3F6EE7DC_ED9224E217unit_test_monitorE () #1 0x004273f7 in __main () #2 0x00401c78 in main () this is on a Windows XP box, with gcc 3.4.2 MinGW, using boost 1.35.0 am I doing something wrong? Akos

Ákos Maróy <akos <at> maroy.hu> writes:
I'm trying to compile and run a very simple unit test using the boost test library on Windows with MinGW, and I'm running into a segfault problem. I searched around the issue, and it seems I've found references to such an issue from 2003:
I've got MingW gcc 3.4.5. And I can't reproduce the issue. Gennadiy

Gennadiy,
I've got MingW gcc 3.4.5. And I can't reproduce the issue.
I see. I tried to recompile my little test app with gcc 3.4.5, but I get the same results. Now I'll recompile boost itself with gcc 3.4.5, and see if it works fine.. Akos

Gennadiy,
I've got MingW gcc 3.4.5. And I can't reproduce the issue.
I recompiled the boost libraries with gcc 3.4.5, and I seem to have the same issue. This is what I get: C:\src\trials\test>gcc --version gcc (GCC) 3.4.5 (mingw special) Copyright (C) 2004 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. C:\src\trials\test>mingw32-make clean all del *.o *.exe g++ -g -frtti -fexceptions -mthreads -Wall -I\src\boost\gcc3.4.5\boost_1_35_0 -c -o test.o test.cpp g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-rel oc -mthreads -Wl,-subsystem,windows -L\src\boost\gcc3.4.5\boost_1_35_0\stage\lib test.o -lboost_test_exec_monitor-mt -lboost_unit_test_framework-mt -o test C:\src\trials\test>gdb test.exe GNU gdb 6.3 Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i686-pc-mingw32"... (gdb) run Starting program: C:\src\trials\test/test.exe Program received signal SIGSEGV, Segmentation fault. 0x00417fbc in global constructors keyed to _ZN5boost9unit_test64_GLOBAL__N_libs_ test_src_unit_test_monitor.cpp_3F6EE7DC_154EA3F417unit_test_monitorE () at /src/boost/gcc3.4.5/boost_1_35_0/boost/test/unit_test_log.hpp:129 129 BOOST_TEST_SINGLETON_INST( unit_test_log ) Current language: auto; currently c++ (gdb) bt #0 0x00417fbc in global constructors keyed to _ZN5boost9unit_test64_GLOBAL__N_l ibs_test_src_unit_test_monitor.cpp_3F6EE7DC_154EA3F417unit_test_monitorE () at /src/boost/gcc3.4.5/boost_1_35_0/boost/test/unit_test_log.hpp:129 #1 0x00426527 in __do_global_ctors () at /src/boost/gcc3.4.5/boost_1_35_0/boost/test/unit_test_log.hpp:129 #2 0x0040122a in __mingw_CRTStartup () #3 0x004012b8 in WinMainCRTStartup () #4 0x7c816d4f in RegisterWaitForInputIdle () from C:\WINDOWS\system32\kernel32.dll #5 0x0022f2a0 in ?? () #6 0x0000003e in ?? () #7 0x7ffdf000 in ?? () #8 0x8054b038 in ?? () #9 0x0022ffc8 in ?? () #10 0x825ce888 in ?? () #11 0xffffffff in ?? () #12 0x7c8399f3 in KERNEL32!FindAtomW () from C:\WINDOWS\system32\kernel32.dll #13 0x7c816d58 in RegisterWaitForInputIdle () from C:\WINDOWS\system32\kernel32.dll #14 0x00000000 in ?? () from #15 0x00000000 in ?? () from #16 0x00000000 in ?? () from #17 0x004012a0 in mainCRTStartup () Previous frame inner to this frame (corrupt stack?) (gdb) the test code is simply: #include <boost/test/unit_test.hpp> using namespace boost::unit_test; void test() { BOOST_CHECK(true); } test_suite * init_unit_test_suite(int, char **) { test_suite *ts = BOOST_TEST_SUITE("Test"); ts->add(BOOST_TEST_CASE(&test)); framework::master_test_suite().add(ts); return 0; } Akos PS: there seems to be some inconsistency with the test library build environment as well, as boost_test_exec_monitor-mt.lib is generated as libboost_test_exec_monitor-mt.lib, even though the other library files don't have the lib prefix.
participants (2)
-
Gennadiy Rozental
-
Ákos Maróy