This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Bug with cerr,cout and flush in gcc 3.1 -- solid example.
- From: olczyk at interaccess dot com (Thaddeus L. Olczyk)
- To: gcc at gcc dot gnu dot org
- Date: Tue, 09 Jul 2002 15:45:42 +0000 (GMT)
- Subject: Bug with cerr,cout and flush in gcc 3.1 -- solid example.
- Organization: stickit@nospammers.com
- Reply-to: olczyk at interaccess dot com
My apologies. I sent a message to the wrong address then overwrote it
with this message before I sent, so it's gone. Eventually I will get
it back and include any information I may have forgotten in a
followup.
I've noticed a bug is g++. It occurs when you call flush on cerr or
cout and link the boost regex library. This happens on a Dual PII-450.
Linux kernel 2.4.8.
Here is a simple example of the bug:
---------------------main.cpp------------------------
#include <iostream>
#include <stdio.h>
using namespace std;
int main(int argc,char *argv[])
{
printf("Hello World.\n");
cout<<"Hello World."<<endl;
#ifdef CRASH
cout.flush();
#endif
}
------------------------------------------------------
g++ -gstabs+ -DCRASH main.cpp
-LWhatever_directory_you_store_libboost_in -lboost_regex_debug
./a.out
Hello World.
Hello World.
g++ -gstabs+ main.cpp -LWhatever_directory_you_store_libboost_in
-lboost_regex_debug
./a.out
Segmentation violation
The problem appears when you have a call to flush ( I've only checked
with cerr and cout ) and link the boost regex library.