From nobody@FreeBSD.org  Tue Sep 17 01:21:40 2013
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
	(using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by hub.freebsd.org (Postfix) with ESMTP id C0328B9E
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 17 Sep 2013 01:21:40 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from oldred.freebsd.org (oldred.freebsd.org [8.8.178.121])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mx1.freebsd.org (Postfix) with ESMTPS id AD1572EDA
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 17 Sep 2013 01:21:40 +0000 (UTC)
Received: from oldred.freebsd.org ([127.0.1.6])
	by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id r8H1LeId098319
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 17 Sep 2013 01:21:40 GMT
	(envelope-from nobody@oldred.freebsd.org)
Received: (from nobody@localhost)
	by oldred.freebsd.org (8.14.5/8.14.5/Submit) id r8H1LeOv098315;
	Tue, 17 Sep 2013 01:21:40 GMT
	(envelope-from nobody)
Message-Id: <201309170121.r8H1LeOv098315@oldred.freebsd.org>
Date: Tue, 17 Sep 2013 01:21:40 GMT
From: Yahor Shybeka <egor.shibeko@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: libc++ iostream initialization problem
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         182175
>Category:       kern
>Synopsis:       libc++ iostream initialization problem
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    dim
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Sep 17 01:30:00 UTC 2013
>Closed-Date:    Mon Feb 24 22:28:21 UTC 2014
>Last-Modified:  Mon Feb 24 22:28:21 UTC 2014
>Originator:     Yahor Shybeka
>Release:        9.2
>Organization:
>Environment:
FreeBSD err0r-laptop.err0r-house 9.2-PRERELEASE FreeBSD 9.2-PRERELEASE #0: Sat Sep 14 05:39:27 EDT 2013     root@err0r-laptop.err0r-house:/usr/obj/usr/src/sys/GENERIC  amd64
>Description:
Hi,

It looks like libc++ in base doesn't have static instance of std::ios_base::Init in <iostream>, a trick which you can find in GCC's header:

  static ios_base::Init __ioinit;

It was discussed with libc++ developer here - http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20130325/077141.html. I'm not sure about shared library initialization order in FreeBSD, but I think it's a problem with libc++.a anyway.

Thanks,
Yahor
>How-To-Repeat:
check the libc++ sources
>Fix:
add static instance of ios::base::Init into <iostream>.

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->dim 
Responsible-Changed-By: dim 
Responsible-Changed-When: Sun Feb 9 21:59:18 UTC 2014 
Responsible-Changed-Why:  

http://www.freebsd.org/cgi/query-pr.cgi?pr=182175 
State-Changed-From-To: open->feedback 
State-Changed-By: dim 
State-Changed-When: Sun Feb 9 21:59:44 UTC 2014 
State-Changed-Why:  
Do you have a test case that demonstrates an actual problem with the 
way libc++ currently does its global iostream initialization? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=182175 
State-Changed-From-To: feedback->closed 
State-Changed-By: dim 
State-Changed-When: Mon Feb 24 22:27:42 UTC 2014 
State-Changed-Why:  
No suitable test case was provided.  Therefore, I am closing this bug. 

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