X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_66,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org To: cygwin AT cygwin DOT com From: Mark Geisert Subject: I want my FPE! Date: Thu, 17 Sep 2009 19:46:15 +0000 (UTC) Lines: 54 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit User-Agent: Loom/3.14 (http://gmane.org/) X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com I would like to get control when floating-point exceptions occur, but the simple approach doesn't seem to work; see the STC below. It shows SIGSEGV can be trapped but not SIGFPE. In another experiment I tried extending libsigsegv to handle FP exceptions but got the same results. Is there something I need to do to "condition" the Cygwin environment to generate FP exceptions? I saw the code in winsup/something/or/other to map x86 FP exceptions to SIGFPE but it seems somehow the exceptions aren't being generated in the first place. Thanks much, ..mark #include #include #include jmp_buf trapoline; void segv_handler(int x) { puts("SIGSEGV handled, continuing"); longjmp(trapoline, 1); } void fpe_handler(int x) { puts("SIGFPE handled, continuing"); longjmp(trapoline, 2); } int main() { signal(SIGSEGV, segv_handler); signal(SIGFPE, fpe_handler); switch(setjmp(trapoline)) { case 0: // first, force a SIGSEGV printf("%X\n", *(int *) 42); break; case 1: // second, force a SIGFPE printf("%f\n", 1E200 * 1E200); break; case 2: // all done break; } return 0; } -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple