This is the mail archive of the egcs@egcs.cygnus.com mailing list for the EGCS project. See the EGCS home page for more information.


[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index] [Subject Index] [Author Index] [Thread Index]

new[] problem with egcs-1.1.1 on hppa1.1-hp-hpux10.20



g++ --version
egcs-2.91.60

Consider a test program:
#include <iostream>

int main()
{
  try {
    cout << "doing allocation which will fail" << endl;
    char *p = new char[0x7fffffff];
  }
  catch( bad_alloc& ) {
    cout << "caught bad_alloc" << endl;
  }
  return 0;
}

This does what you would expect (so long as you don't run as root) on
solaris and linux; the allocation fails, a bad_alloc is thrown and caught.

On hppa1.1-hp-hpux10.20, the usage of new causes the program to dump core,
and in less simple cases from this test code, g++ doesn't even want to parse
the bad_alloc (!)  I can't exactly reproduce the latter part, but I would
assume bad_alloc is defined if I at least include <alloc.h>, but this isn't
helping me.

ANY help would be greatly appreciated.
Thanks!