misc/164144: Crash on sending float/double values to
std::ostringstream
Shane Ambler
FreeBSD at Shaneware.biz
Sun Jan 15 16:40:10 UTC 2012
>Number: 164144
>Category: misc
>Synopsis: Crash on sending float/double values to std::ostringstream
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Sun Jan 15 16:40:09 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator: Shane Ambler
>Release: 9.0-RELEASE
>Organization:
>Environment:
FreeBSD leader 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Tue Jan 3 07:46:30 UTC 2012 root at farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64
>Description:
In c++ code sending a float or double value to a std::ostringstream using a << operator causes an illegal instruction. Sending a long double in the same place works.
I find clang++ g++ and g++46 produce the same results so expect this is within libc++.
This bug was found running blender - it is used within the elbeem lib code for fluid sims.
Within gdb the following example code gives -
For float values --
Program received signal SIGILL, Illegal instruction.
0x00000008008e0060 in std::ostream::operator<< (this=0x7fffffffd2c0, __f=100.255997) at ostream.tcc:221
221 ostream.tcc: No such file or directory.
in ostream.tcc
Current language: auto; currently c++
For double values --
Program received signal SIGILL, Illegal instruction.
0x00000008008dfe6b in std::ostream::_M_insert<double> (this=0x7fffffffd2c0, __v=100.256) at ostream.tcc:221
221 ostream.tcc: No such file or directory.
in ostream.tcc
Current language: auto; currently c++
>How-To-Repeat:
Build the following - clang++ test.cpp - and run
#include <sstream>
int main(int argc, char ** argv)
{
std::ostringstream testout;
// broken
testout << (float)100.256;
// broken
testout << (double)100.256;
// works
testout << (long double)100.256;
// exit nicely if we get here
return 0;
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list