This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/57484] New: 'std::numeric_limits< T >::signaling_NaN()' signaling-bit is incorrect for x86 32-bit.
- From: "zxClhzAApX1EdJwQANqrjLERmFeURQVy at cynd dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 31 May 2013 15:24:53 +0000
- Subject: [Bug c++/57484] New: 'std::numeric_limits< T >::signaling_NaN()' signaling-bit is incorrect for x86 32-bit.
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57484
Bug ID: 57484
Summary: 'std::numeric_limits< T >::signaling_NaN()'
signaling-bit is incorrect for x86 32-bit.
Product: gcc
Version: 4.7.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: zxClhzAApX1EdJwQANqrjLERmFeURQVy at cynd dot net
Created attachment 30234
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30234&action=edit
C++ test program to extract and display the signaling-bit of a signaling-NaN
and a quiet-NaN.
$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
4.7.3-1ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs
--enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.7 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls
--with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin
--with-system-zlib --enable-objc-gc --with-cloog --enable-cloog-backend=ppl
--disable-cloog-version-check --disable-ppl-version-check --enable-multiarch
--disable-werror --with-arch-32=i686 --with-abi=m64
--with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-1ubuntu1)
What I expect:
For 'float' and 'double' types when 'std::numeric_traits< T >::is_iec559' is
'true', 'std::numeric_traits< T >::signaling_NaN()' should generate a IEEE-754
value whose sign bit is '0', exponent bits are all '1', the highest significand
bit is '0', and some other significant bit(s) are '1'.
What I observe:
- x86 32-bit: all expectations are met, except that the highest significand
bit is '1'. ( This implies it is a quiet-NaN, not a signaling-NaN. )
- x86 64-bit: all expectations are met.
My evidence:
Attached is a test C++ program that extracts the IEEE-754 signaling bit value
of both a signaling-NaN and a quiet-NaN, for 'float' and 'double' types, and
prints the results to console. When compiling with '-m32', I see the
unexpected behavior; when compiling with '-m64', I see the expected behavior.
Compiler flags / command-line:
- x86 32-bit: g++ -m32 -Wall -Wextra test-signaling-nan.cpp
- x86 64-bit: g++ -m64 -Wall -Wextra test-signaling-nan.cpp
Compilation errors / warnings:
None.