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

David Chisnall theraven at sucs.org
Wed Feb 29 08:32:04 PST 2012

Two replies so far, and everyone seems to be assuming you're talking about libcxxrt, not libc++.  For future reference, calling libc++ libcxx apparently confuses people...

As to the bug, I've seen crashes like this before when doing the FreeBSD and Solaris ports.  As I recall, that exception is thrown when the locale_t is NULL.  In this case, I would expect you to be using the C locale.  I believe on glibc that this is generated by calling __cloc(), so this may be a good place to look.


On 29 Feb 2012, at 14:03, Bruce Stephens wrote:

> 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.)
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

-- Sent from my Difference Engine

More information about the cfe-dev mailing list