[Bug sanitizer/87453] Maybe implement -fsanitize=float-cast-overflow and -fsanitize=float-divide-by-zero

amonakov at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Sep 27 15:34:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87453

Alexander Monakov <amonakov at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amonakov at gcc dot gnu.org

--- Comment #2 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
These two seem a bit too specific. They are also not undefined behavior (just
like unsigned integer overflow is not).

I imagine what people would rather want is a way to detect floating point
operations resulting in a NaN or infinity, i.e.

 - -fsanitize=float-nan-result
 - -fsanitize=float-nonfinite-result

Doing that via instrumentation would have some overhead though. Today people
can partially achieve that with zero overhead by enabling FPU exceptions, but
it's not so trivial when some exceptions are produced in third-party code (but
you don't want to trap on them).

Is there information on why Clang implemented those two options, was there
significant demand for those kinds specifically?


More information about the Gcc-bugs mailing list