X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Message-ID: <4AB29DDF.301@gmail.com> Date: Thu, 17 Sep 2009 21:36:47 +0100 From: Dave Korn User-Agent: Thunderbird 2.0.0.17 (Windows/20080914) MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: I want my FPE! References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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 Mark Geisert wrote: > 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. Very possibly not. There's probably a bit in the FPUCW you need to set or something. Ah, yes: see winsup/cygwin/crt0.c: > /* In the following ifdef'd i386 code, the FPU precision is set to 80 bits > and all FPU exceptions are masked. The former is needed to make long > doubles work correctly. The latter causes the FPU to generate NaNs and > Infinities instead of signals for certain operations. > */ > #define FPU_RESERVED 0xF0C0 > #define FPU_DEFAULT 0x033f > { > volatile unsigned short cw; > > /* Get Control Word */ > __asm__ volatile ("fnstcw %0" : "=m" (cw) : ); > > /* mask in */ > cw &= FPU_RESERVED; > cw |= FPU_DEFAULT; > > /* set cw */ > __asm__ volatile ("fldcw %0" :: "m" (cw)); > } You can copy and paste that hunk into your own main() and change the constants to anything you like. cheers, DaveK -- 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