From dbe905c140d0cd347c731f63b153dca53857bdc9 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 26 Jun 2018 10:09:29 +0200 Subject: [PATCH] Cygwin: exceptions: fix FPE exception flags The FPE flags for divisions by zero were not implemented Signed-off-by: Corinna Vinschen --- winsup/cygwin/exceptions.cc | 8 +++++++- winsup/cygwin/release/2.11.0 | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index 77eff0570..419b0976f 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -649,9 +649,15 @@ exception::handle (EXCEPTION_RECORD *e, exception_list *frame, CONTEXT *in, /* Coerce win32 value to posix value. */ switch (e->ExceptionCode) { - case STATUS_FLOAT_DENORMAL_OPERAND: case STATUS_FLOAT_DIVIDE_BY_ZERO: + si.si_signo = SIGFPE; + si.si_code = FPE_FLTDIV; + break; + case STATUS_FLOAT_DENORMAL_OPERAND: case STATUS_FLOAT_INVALID_OPERATION: + si.si_signo = SIGFPE; + si.si_code = FPE_FLTINV; + break; case STATUS_FLOAT_STACK_CHECK: si.si_signo = SIGFPE; si.si_code = FPE_FLTSUB; diff --git a/winsup/cygwin/release/2.11.0 b/winsup/cygwin/release/2.11.0 index ef7d08256..33f5fb9ae 100644 --- a/winsup/cygwin/release/2.11.0 +++ b/winsup/cygwin/release/2.11.0 @@ -33,3 +33,6 @@ Bug Fixes - Fix a g++ compilation problem with -std=c++14 or -std=c++17. Addresses: https://cygwin.com/ml/cygwin/2018-05/msg00316.html + +- Fix FPE flag handling for division by zero conditions + Addresses: https://cygwin.com/ml/cygwin/2018-06/msg00281.html