This is the mail archive of the cygwin-cvs@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[newlib-cygwin] Cygwin: exceptions: fix FPE exception flags


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=dbe905c140d0cd347c731f63b153dca53857bdc9

commit dbe905c140d0cd347c731f63b153dca53857bdc9
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Tue Jun 26 10:09:29 2018 +0200

    Cygwin: exceptions: fix FPE exception flags
    
    The FPE flags for divisions by zero were not implemented
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 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 77eff05..419b097 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 ef7d082..33f5fb9 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


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