[cfe-dev] libcxx std::cerr on GNU/Linux

Bruce Stephens bruce.r.stephens at gmail.com
Wed Feb 29 06:03:11 PST 2012


clang++ and libcxx seems mostly to work (I've been using clang for a
little while on our source tree and it's revealed a number of problems,
and libcxx has shown another couple, I think).

Actually running executables also seems to work, except for output to
std::cerr:

#include <iostream>
int main()
{
    std::cout << "Hello world\n";
}

works fine, and valgrind seems happy with it. Changing the cout to cerr
causes a crash (after producing the output):

#0  0x00007fd207b59475 in *__GI_raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1  0x00007fd207b5c6f0 in *__GI_abort () at abort.c:92
#2  0x00007fd208388acb in std::uncaught_exception () at ../src/exception.cpp:103
#3  0x00007fd2083913ca in std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::~sentry (this=<optimized out>) at ../include/ostream:243
#4  0x0000000000400d6a in std::__1::operator<< <std::__1::char_traits<char> > (__os=..., __str=0x40135c "Hello world\n") at /usr/local/include/ostream:989
#5  0x0000000000400abd in main () at hello.cpp:4

Any ideas about what might cause this? (It feels odd that cout and cerr
should differ in such a way, but I haven't really looked at the
implementation so perhaps it's obvious.)



More information about the cfe-dev mailing list