diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index 0d9e8f70e..61406e5d1 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -762,6 +762,25 @@ exception::handle (EXCEPTION_RECORD *e, exception_list *frame, CONTEXT *in, handling. */ return ExceptionContinueExecution; +#ifdef __x86_64__ +/* From the GCC source file libgcc/unwind-seh.c. */ +#define STATUS_USER_DEFINED (1U << 29) +#define GCC_MAGIC (('G' << 16) | ('C' << 8) | 'C') +#define GCC_EXCEPTION(TYPE) \ + (STATUS_USER_DEFINED | ((TYPE) << 24) | GCC_MAGIC) +#define STATUS_GCC_THROW GCC_EXCEPTION (0) +#define STATUS_GCC_UNWIND GCC_EXCEPTION (1) +#define STATUS_GCC_FORCED GCC_EXCEPTION (2) + + case STATUS_GCC_THROW: + case STATUS_GCC_UNWIND: + case STATUS_GCC_FORCED: + /* According to a comment in the GCC function + _Unwind_RaiseException(), GCC expects us to continue all the + (continuable) GCC exceptions that reach us. */ + return ExceptionContinueExecution; +#endif + default: /* If we don't recognize the exception, we have to assume that we are doing structured exception handling, and we let diff --git a/winsup/cygwin/release/3.1.7 b/winsup/cygwin/release/3.1.7 index 2f4856495..83cff2b46 100644 --- a/winsup/cygwin/release/3.1.7 +++ b/winsup/cygwin/release/3.1.7 @@ -11,3 +11,7 @@ Bug Fixes: - Fix an mmap issue that could cause failure with errno EFBIG Partially addresses: https://sourceware.org/pipermail/cygwin/2020-July/245557.html + +- Fix the behavior of C++ apps after an unhandled exception (64-bit only) + Addresses: https://cygwin.com/pipermail/cygwin/2019-October/242795.html + https://cygwin.com/pipermail/cygwin/2020-August/245897.html