New issue
Advanced search Search tips

Issue 645700 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Some/all tests should be run with _EM_INVALID enabled, maybe others

Project Member Reported by brucedaw...@chromium.org, Sep 10 2016

Issue description

Floating-point math has an answer for everything, even if the question is 1.0/0.0 (INF) or 0.0/0.0 (NaN) or 1.0+Nan (NaN). It even has an answer for "Pop the floating-point value off of the x87 stack even though the stack is empty" although I think that answer is indeterminate.

However some of these answers we don't actually want. And yet, we get them because Chrome, like most Windows software, runs with floating-point exceptions suppressed. This allowed a code-gen bug in PGO builds:

https://connect.microsoft.com/VisualStudio/feedback/details/3102400

to go unnoticed for a while and unfixed for even longer. If we enabled some floating-point exceptions during tests we might also find logic bugs. Or we might find a bunch of benign divide-by-zero errors, but we can always just enable the most useful exceptions.

See this (excellent) blog post for more information.

https://randomascii.wordpress.com/2012/04/21/exceptional-floating-point/

 
Summary: Some/all tests should be run with _EM_INVALID enabled, maybe others (was: Some/all tests should be run with EXCEPTION_FLT_STACK_CHECK enabled, maybe others)
The set of exceptions to enable is probably:

_EM_OVERFLOW | _EM_ZERODIVIDE | _EM_INVALID

The others (_EM_INEXACT | _EM_UNDERFLOW | _EM_DENORMAL) trigger extremely often and rarely if ever imply a bug.

EXCEPTION_FLT_STACK_CHECK is a subset of _EM_INVALID. _EM_INVALID also includes things like INF-INF, NAN+NAN, sqrt(-1), etc.

Note that FPU exceptions are enabled/disabled on a per-thread basis. Ideally we would enable them on every thread.

Sign in to add a comment