X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Message-ID: <4A5AEEDC.4050308@gmail.com> Date: Mon, 13 Jul 2009 09:22:52 +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: gcc4: -ffast-math causes segfaults References: <4A5A9D1E DOT 8040905 AT users DOT sourceforge DOT net> In-Reply-To: <4A5A9D1E.8040905@users.sourceforge.net> 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 Yaakov (Cygwin/X) wrote: > Just today I have encountered two cases, one C and one C++, where > compiling with gcc-4.3 and -ffast-math (which was added by the packages > in question) caused segfaults in the resulting executables. > > Are there any known issues with -ffast-math that I should be aware of? Yes. -ffaast-math allows the compiler to generate SSE instructions. This is a problem if used with plain uninitialised C common variable declarations, because the PE file format doesn't have a way to specify the alignment of common section allocations. Fixing this required adding support to both binutils and GCC; the new release of binutils includes this support, and both GCC HEAD and the coming-real-soon-now gcc-4.3.3-1 contain code to make use of the new ability. To verify if that's what you're running into, try your exe under the debugger, and take a look at the instruction that's faulting; for example if you see it's loading or storing an xmm or one of the other sse/etc registers, and the address is only 8-aligned, you'll know you've run into this problem. 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