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]

egcs-1.1a: new don't throw bad_alloc



I installed the egcs-1.1a (with static libs) into a 'egcs' directory.
I still have the gcc 2.7.2.3 and egcs-2.90.27 980315 (egcs-1.0.2 release).
My configuration:
Linux (RedHat 5.1), Pentium II
binutils 2.9.1.0.4

The operator new don't throw bad_alloc if the allocation fails.

eg++ main.cc
a.out
Segmentation fault (core dumped).

// main.cc
# include <iostream.h>
# include <exception>

int main()
{
  try {
     char* p = new char[4000000000UL];
     p[1000] = 'x';
     delete [] p;
  }
  catch (exception& exc) {   
     cerr << exc.what() << '\n';
  }
}


Ryszard Kabatek

Martin-Luther University Halle-Wittenberg
Department of Physical Chemistry
Geusaer Str. 88, 06217 Merseburg, Germany
Tel. +49 3461 46 2487 Fax. +49 3461 46 2129
e-mail: kabatek@chemie.uni-halle.de



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