From nobody@FreeBSD.org  Sun Jan 15 16:32:09 2012
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EBBBC1065675
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 15 Jan 2012 16:32:09 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id DAE738FC1C
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 15 Jan 2012 16:32:09 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q0FGW9Oj010739
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 15 Jan 2012 16:32:09 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id q0FGW96B010738;
	Sun, 15 Jan 2012 16:32:09 GMT
	(envelope-from nobody)
Message-Id: <201201151632.q0FGW96B010738@red.freebsd.org>
Date: Sun, 15 Jan 2012 16:32:09 GMT
From: Shane Ambler <FreeBSD@Shaneware.biz>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Crash on sending float/double values to std::ostringstream
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         164144
>Category:       kern
>Synopsis:       [libc++] Crash on sending float/double values to std::ostringstream
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jan 15 16:40:09 UTC 2012
>Closed-Date:    Sat Feb 04 15:52:03 UTC 2012
>Last-Modified:  Sat Feb 04 15:52:03 UTC 2012
>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@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:

From: Shane Ambler <FreeBSD@ShaneWare.Biz>
To: bug-followup@FreeBSD.org, FreeBSD@Shaneware.biz
Cc:  
Subject: Re: kern/164144: [libc  ] Crash on sending float/double values to
 std::ostringstream
Date: Sat, 04 Feb 2012 21:03:59 +1030

 This can be closed.
 
 build/install world fixed the issue.
 
 For reference (main steps over 6 week period) -
 
 starting with a new machine I installed PCBSD 9.0-RC3-amd64
 I used freebsd-update to update to #p1
 found the issue
 used freebsd-update to install FreeBSD 9.0-RELEASE
 portupgrade -af
 issue seemed worse/more widespread.
 build/install world/kernel (with clang) fixed the issue
 
 
 Not sure yet if something is wrong with pcbsd-9.0rc3 or something was 
 damaged/replaced along the way.
 
 Unsure if starting with pcbsd install had any effect on this.
 
 Using freebsd-update to upgrade from rc3 to release obviously didn't fix 
 the damage.
 
 
 -- 
 
 Shane Ambler
 FreeBSD (at) ShaneWare (dot) Biz
State-Changed-From-To: open->closed 
State-Changed-By: linimon 
State-Changed-When: Sat Feb 4 15:51:46 UTC 2012 
State-Changed-Why:  
Closed at submitter's request. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=164144 
>Unformatted:
