[Bug libstdc++/86130] Expect SIGSEGV but program just silently exits
p.sanders at alpinesoft dot co.uk
gcc-bugzilla@gcc.gnu.org
Wed Jun 13 20:54:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86130
--- Comment #12 from Paul Sanders <p.sanders at alpinesoft dot co.uk> ---
Sorry, I posted that in a bit of a rush. I took a proper look and the null
pointers that set badbit actually make excellent sense.
So I'll suggest a way out of the backwards compatibility conundrum when
`ostream::operator<<` is passed a null pointer (of any sort). The suggestion I
have is to test for a null pointer _only_ if the stream is set up to throw
badbit exceptions Otherwise, just blindly dereference the pointer and crash.
The rationale for this is that people who have set up an exception handler for
badbit _might_ just have done so to catch null pointers. I think it's unlikely
but it's possible. Those who haven't are probably getting away with something
they shouldn't.
Any interest?
More information about the Gcc-bugs
mailing list