This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/40391] Segfault with -O, iostream, anonymous namespace on PPC
- From: "fp at mc dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 10 Jun 2009 12:50:03 -0000
- Subject: [Bug middle-end/40391] Segfault with -O, iostream, anonymous namespace on PPC
- References: <bug-40391-11755@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #6 from fp at mc dot com 2009-06-10 12:50 -------
Jonathan,
thank you for identifying the bug in my original code.
According to my copy of ISO 14992:1998, std::iostream does not have a default
constructor. However, my reading of the standard leads me to believe that it
is valid to pass a null pointer. The description for basic_ios::init()
(27.4.4.1) says that, as a postcondition, rdstate() is "goodbit if sb is not a
null pointer, otherwise badbit".
libstdc++ does provide a default constructor for std::iostream.
However, either way, passing a null std::streambuf pointer to std::iostream
(which I believe is valid), or calling the "gcc extension" default constructor,
both still lead to a crash.
I've looked at the source code for std::iostream and its base classes and it
does not appear to dereference sb, it merely assigns the pointer to a meber
variable and tests it for non-null.
I am updating the test case.
Can someone please do me a favor and test this with a more current version of
gcc?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40391