[llvm-bugs] [Bug 24585] Constant folding disagrees with GCC and FPU on result of 0./0.

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Aug 26 12:04:09 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=24585

David Majnemer <david.majnemer at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |david.majnemer at gmail.com
         Resolution|---                         |INVALID

--- Comment #1 from David Majnemer <david.majnemer at gmail.com> ---
We constant fold 0/0 to a NaN without the sign bit while your processor
generates a NaN with the sign bit.

After consulting the C++ standard, there doesn't appear to be a restriction on
what sorts of NaNs we are permitted to give back for such expressions.

For example, consider:
#include <cmath>
#include <stdio.h>
int main() {
  volatile double zerov = 0.0;
  printf("%d %d\n", (int)std::signbit(zerov/zerov), (int)std::signbit(NAN));    
}

This program prints out "1 0" for clang and GCC but "1 1" for MSVC 2015.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150826/570ffad3/attachment.html>


More information about the llvm-bugs mailing list