This is the mail archive of the gcc-bugs@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]

g++ 2.95.2 trouble with throw


Hi,

The GCC Version:
	gcc-2.95.2

The system Type:
	SUN-Sparc/Solaris-2.7 or IBM/AIX-4.3.2 or LynxOS-3.0.1

All options you passed to the compiler:
	g++ -o except except.cc

Source file:
--------------------------------------------------------------------------------
#include <iostream.h>
#include <new.h>
#include <stdlib.h>

void my_new_handler ( ) 
    {
    cout << "my_new_handler here!" << endl;
    throw 1;
    }

int main ( ) 
    {
    char *bufptr=(char *)1;

    set_new_handler(&my_new_handler);

    try 
      {
      while (bufptr != 0) 
	{
	bufptr=new char[0x100000];
	cout << "while: bufptr is " << ((unsigned long int) bufptr) << endl;
	}
      cout << "bufptr is " << ((unsigned long int) bufptr) << endl;
      } 
    catch (...) 
      {   
      cout << "caught the exception " << endl; 
      }
    return 0;
    }
--------------------------------------------------------------------------------

Description:
instead of getting the message :
...
while: bufptr is 599796936
while: bufptr is 600845528
while: bufptr is 601894120
my_new_handler here!
caught the exception 

You get these messages:
...
while: bufptr is 598766368
while: bufptr is 599814960
while: bufptr is 600863552
while: bufptr is 601912144
my_new_handler here!
Abort

The first case is when you use gcc version 2.8.1 the second is when you use
the gcc version 2.95.2

Something I miss ?

Michel Fouques
+--------------------------------------------------------------+
| Phone: (+33) 04 94 16 34 00   Fax: (+33) 04 94 16 34 01      |
| email: fouques@cetia.fr       Web: http://www.cetia.com      |
+--------------------------------------------------------------+


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