[Bf-committers] floating point exception calls needed for osx/windows (--debug-fpe)
Nathan Letwory
jesterking at letwory.net
Thu May 27 01:05:12 CEST 2010
On 24.5.2010 7:52, Campbell Barton wrote:
> The argument --debug-fpe to enable floating point exceptions currently
> only works on linux& SGI.
I've committed support for Windows (with MSVC) in r29013 for this.
/Nathan
>
> This command is useful for tracking down invalid floating point math,
> divide by zero, invalid arguments to math.h functions& operations
> resulting in NAN or INF, since you get a crash at the point in the
> code where the error is made.
>
> For example, it made finding this bug simple ([#22398 black pixels
> with HDR textures).
> http://markmail.org/message/vlkta3nzwmm3sywr
>
> This is the function in creator.c now. just needs mac/windows #ifdefs,
> probably not hard but needs testing by a developer who uses osx/win.
>
> ---
>
> static int set_fpe(int argc, char **argv, void *data)
> {
> #if defined(__sgi) || defined(__linux__)
> /* zealous but makes float issues a heck of a lot easier to find!
> * set breakpoints on fpe_handler */
> signal(SIGFPE, fpe_handler);
>
> #if defined(__linux__)&& defined(__GNUC__)
> feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW );
> #endif
> #endif
> return 0;
> }
>
--
Nathan Letwory
Letwory Interactive
http://www.letworyinteractive.com
More information about the Bf-committers
mailing list