This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Bug with cerr,cout and flush in gcc 3.1 -- solid example.


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]