[LLVMbugs] [Bug 15054] New: 32bit Build always write's snan
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Jan 23 13:14:51 PST 2013
http://llvm.org/bugs/show_bug.cgi?id=15054
Bug #: 15054
Summary: 32bit Build always write's snan
Product: clang
Version: 3.2
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: trev.norris at gmail.com
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
Have a problem that signaling nan's are always written when built with -m32.
Test case (original here: https://gist.github.com/0c340629e451ff31ef66)
#include <limits>
#include <cstdio>
#include <cstring>
int main()
{
union {
unsigned char b[sizeof(double)];
double d;
float f;
} u;
memset(&u, 0, sizeof(u));
u.f = std::numeric_limits<float>::signaling_NaN(); //__builtin_nansf("");
printf("%02x %02x %02x %02x %02x %02x %02x %02x\n",
u.b[0], u.b[1], u.b[2], u.b[3],
u.b[4], u.b[5], u.b[6], u.b[7]);
u.f = std::numeric_limits<float>::quiet_NaN(); //__builtin_nanf("");
printf("%02x %02x %02x %02x %02x %02x %02x %02x\n",
u.b[0], u.b[1], u.b[2], u.b[3],
u.b[4], u.b[5], u.b[6], u.b[7]);
u.d = std::numeric_limits<double>::signaling_NaN(); //__builtin_nans("");
printf("%02x %02x %02x %02x %02x %02x %02x %02x\n",
u.b[0], u.b[1], u.b[2], u.b[3],
u.b[4], u.b[5], u.b[6], u.b[7]);
u.d = std::numeric_limits<double>::quiet_NaN(); //__builtin_nan("");
printf("%02x %02x %02x %02x %02x %02x %02x %02x\n",
u.b[0], u.b[1], u.b[2], u.b[3],
u.b[4], u.b[5], u.b[6], u.b[7]);
}
$ for CXX in clang++ g++; do for M in 32 64; do $CXX -m$M -o tmp/snan-$CXX$M
tmp/snan.cc; echo "*** $CXX $M bits"; tmp/snan-$CXX$M; done; done
*** clang++ 32 bits
00 00 c0 ff 00 00 00 00
00 00 c0 ff 00 00 00 00
00 00 00 00 00 00 f8 ff
00 00 00 00 00 00 f8 ff
*** clang++ 64 bits
00 00 a0 7f 00 00 00 00
00 00 c0 7f 00 00 00 00
00 00 00 00 00 00 f4 7f
00 00 00 00 00 00 f8 7f
*** g++ 32 bits
00 00 e0 7f 00 00 00 00
00 00 c0 7f 00 00 00 00
00 00 00 00 00 00 fc 7f
00 00 00 00 00 00 f8 7f
*** g++ 64 bits
00 00 a0 7f 00 00 00 00
00 00 c0 7f 00 00 00 00
00 00 00 00 00 00 f4 7f
00 00 00 00 00 00 f8 7f
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list