This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/24555] New: Sending output to cout stream sporadically causes segfault
- From: "springmalnachlinks at yahoo dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 27 Oct 2005 07:44:59 -0000
- Subject: [Bug c++/24555] New: Sending output to cout stream sporadically causes segfault
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Used g++ 4.0.2 with accompanying libstdc++ 4.0.2 under SuSE Linux 10 64-bit and
Ubuntu Linux 5.10 32-bit. Using both 64-bit g++ with and without -m32 switch,
as well as 32-bit g++, cout << occasionally produces a segfault which could not
be reproduced under 3.3.5 or various flavors of 3.4. Downgrading to gcc, g++,
cpp and libcstd++ 3.4 under Ubuntu 5.10 solved the problem, under SuSE 10 this
is more difficult.
In the following code, cout produces a segfault in the second do-while loop but
not in the first, although structurally the two are identical:
do
{
os_clear_screen();
display_message();
cout << endl << _BOARDSIZESELECT;
getline(cin,boardsize_entry_string,'\n');
check_boardsize();
} while ((boardsize<3)||(boardsize>8));
do
{
os_clear_screen();
display_message();
cout << endl << _PLAYERCOUNTSELECT;
getline(cin,playercount_entry_string,'\n');
check_playercount();
} while ((playercount<1)||(playercount>2));
Replacing cout << with calls to printf seems to solve the problem, but passing
variables of type string to printf requires more effort and more time.
--
Summary: Sending output to cout stream sporadically causes
segfault
Product: gcc
Version: 4.0.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: springmalnachlinks at yahoo dot de
GCC build triplet: amd64-pc-linux & i686-pc-linux
GCC host triplet: amd64-pc-linux & i686-pc-linux
GCC target triplet: amd64-pc-linux & i686-pc-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24555