g++ successfully compiled "Hello World" program causes segfault at runtime

Dan Nelson dnelson at allantgroup.com
Thu Jun 9 20:14:33 GMT 2005


In the last episode (Jun 09), Keyser said:
> I posted this topic a few days ago but still haven't found a solution
> yet.  However, I believe I'm able to provide more information now. 
> Here is a log showing what I'm up against:
> 
> vitoc# cat test.cpp
> #include <iostream>
> using namespace std;
> 
> int main()
> {
> cout << "Hello world!";
> return 0;
> }
> vitoc# g++ -g -o test test.cpp
> vitoc# gdb test
> (gdb) run
> Starting program: /usr/temp/cpp/test
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x2819d7de in wctype () from /lib/libc.so.5
> (gdb) bt
> #0  0x2819d7de in wctype () from /lib/libc.so.5
> #1  0x28119002 in std::ctype<wchar_t>::_M_convert_to_wmask () from /usr/lib/libstdc++.so.4
> #2  0x28119453 in std::ctype<wchar_t>::_M_initialize_ctype () from /usr/lib/libstdc++.so.4
> #3  0x28119b08 in std::ctype<wchar_t>::ctype () from /usr/lib/libstdc++.so.4
> #4  0x28112a69 in std::locale::_Impl::_Impl () from /usr/lib/libstdc++.so.4

Do you have any locale environment variables set?  The program runs
fine on my machine.

-- 
	Dan Nelson
	dnelson at allantgroup.com


More information about the freebsd-questions mailing list