From: M DOT H DOT M DOT Michels AT kub DOT nl (Tijs Michels) Subject: Divide by zero fails to produce SIGFPE 6 Apr 1998 16:30:29 -0700 Message-ID: <199804060801.KAA10518.cygnus.gnu-win32@mailnews.kub.nl> Reply-To: M DOT H DOT M DOT Michels AT kub DOT nl Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7BIT To: gnu-win32 AT cygnus DOT com Hi everyone, Is it possible to get cygwin32 to respond to division by zero with SIGFPE? I ported Yorick 1.4, ran the self test and got the following error message: "**WARNING** 1.0/0.0 does not trigger SIGFPE" In fact, division by zero yields "Inf". For Yorick to run reliably, division by zero *must* yield SIGFPE. Quite a few systems fail to produce SIGFPE, and the Yorick distribution comes with a patch for most of them. Unfortunately cygwin32 is not included. Now I searched the cygwin32 tree for "divide by zero" and found in +++/i386-cygwin32/include/ieeefp.h: [...] /* EXCEPTIONS */ typedef int fp_except; #define FP_X_INV 0x10 /* Invalid operation */ #define FP_X_DX 0x80 /* Divide by zero */ #define FP_X_OFL 0x04 /* Overflow exception */ #define FP_X_UFL 0x02 /* Underflow exception */ #define FP_X_IMP 0x01 /* imprecise exception */ [...] Yorick has a patch for Solaris which reads: #include < ieeefp.h > fpsetmask(FP_X_INV | FP_X_DZ | FP_X_OFL); However, cygwin32 does not seem to include the fpsetmask function. (And what about the difference between FP_X_DX and FP_X_DZ? Is this a typo?) I contacted David Munro (munro AT icf DOT llnl DOT gov), author of Yorick. He was interested in the cygwin32 port, but unaware of a way to get cygwin32 to produce SIGFPE. However, he did send me a program to test for proper divide by zero handling. It is attached to this mail. I can't get it to produce SIGFPE. Perhaps someone better versed in C than I could give it a shot. Thanks and best wishes, Tijs m DOT h DOT m DOT michels AT kub DOT nl Ps: Apart from this, Yorick works great! - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".