https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86130
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |msebor at gcc dot gnu.org Component|c++ |libstdc++ --- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> --- The iostream inserters for char* require the pointer be non-null (and valid), so their behavior is undefined otherwise. Libstdc++ detects the null pointer and sets badbit in response which has the effect of discarding all subsequent output sent to the stream. If Clang/libc++ fails with a SEGV that's most likely because libc++ doesn't have this feature. FWIW, I don't think think detecting null pointers like this in the library is a useful feature. They should be treated the same as any other invalid pointer: i.e., let GCC decide what to do, which may be to issue a warning when it can detect the pointer is null (and either let the code SEGV or drop the dereference).