[cfe-dev] Clang-Cl - Representation of NAN; Code to reproduce

Kaylor, Andrew via cfe-dev cfe-dev at lists.llvm.org
Tue Feb 5 12:54:09 PST 2019


Actually, it looks like MSVC always does the division. The sign bit doesn’t matter.

FWIW, gcc also does the division in the non-volatile 0.0/0.0 case because it is preserving the floating point status flag that gets set by this operation. If you pass -ffast-math or -fno-trapping-math to gcc it will constant fold (to the same value clang uses). I can’t get MSVC to do the constant folding, but I might just not know the right option.

It's probably worth mentioning that clang doesn’t guarantee that floating point exception/status flag semantics will be preserved. That’s currently under development.

-Andy

From: Marcus Johnson <bumblebritches57 at gmail.com>
Sent: Tuesday, February 05, 2019 12:24 PM
To: Kaylor, Andrew <andrew.kaylor at intel.com>
Cc: Gaier, Bjoern <Bjoern.Gaier at horiba.com>; cfe-dev at lists.llvm.org
Subject: Re: [cfe-dev] Clang-Cl - Representation of NAN; Code to reproduce

So MSVC's setting the sign bit when it shouldn't, report the bug to them.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20190205/e51a99cb/attachment.html>


More information about the cfe-dev mailing list