This is the mail archive of the cygwin 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]

Re: gcc4: -ffast-math causes segfaults


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


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