am 535027e4: Uncaught exception could not be rethrown. Fix of CCVS/Sec15/1/P15144.C

* commit '535027e476b6e6b5cd214e3fe81f7c2e884f98d7':
  Uncaught exception could not be rethrown. Fix of CCVS/Sec15/1/P15144.C
diff --git a/src/exception.cc b/src/exception.cc
index 736c65b..edd99ae 100644
--- a/src/exception.cc
+++ b/src/exception.cc
@@ -673,6 +673,11 @@
  * If the failure happened by falling off the end of the stack without finding
  * a handler, prints a back trace before aborting.
  */
+#if __GNUC__ > 3 && __GNUC_MINOR__ > 2
+extern "C" void *__cxa_begin_catch(void *e) throw();
+#else
+extern "C" void *__cxa_begin_catch(void *e);
+#endif
 static void report_failure(_Unwind_Reason_Code err, __cxa_exception *thrown_exception)
 {
 	switch (err)
@@ -687,6 +692,8 @@
 			break;
 #endif
 		case _URC_END_OF_STACK:
+			__cxa_begin_catch (&(thrown_exception->unwindHeader));
+ 			std::terminate();
 			fprintf(stderr, "Terminating due to uncaught exception %p", 
 					static_cast<void*>(thrown_exception));
 			thrown_exception = realExceptionFromException(thrown_exception);
@@ -716,6 +723,9 @@
 			// Print a back trace if no handler is found.
 			// TODO: Make this optional
 			_Unwind_Backtrace(trace, 0);
+
+			// Just abort. No need to call std::terminate for the second time
+			abort();
 			break;
 	}
 	std::terminate();