<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Apr 14, 2014 at 8:46 AM, Kevin Locke <span dir="ltr"><<a href="mailto:kevin@kevinlocke.name" target="_blank">kevin@kevinlocke.name</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class=""><br>
On Sun, 2014-04-13 at 17:36 -0700, Richard Smith wrote:<br>
> On Mon, Apr 7, 2014 at 3:11 PM, Kevin Locke <<a href="mailto:kevin@kevinlocke.name">kevin@kevinlocke.name</a>> wrote:<br>
</div><div class="">>> I've been trying to track down an EXC_BAD_ACCESS error (Bus error: 10)<br>
>> which occurs during static initialization when linking a program using<br>
>> boost to a library using boost.  The problem occurred, for me, with<br>
>> QuantLib, but it has been reported to occur with mlpack[1] and likely<br>
>> affects other boost-using libraries as well.  I have determined that<br>
>> the issue occurs when a library is compiled with -std=c++11 and the<br>
>> program is not (or vice versa).<br>
><br>
</div><div class="">> This is a known issue that we've discussed in the past (though I can't find<br>
> a record of the discussion right now). The issue, in the general case, is<br>
> that it's possible for a common variable (local static or static data<br>
> member of a class template specialization or variable template<br>
> specialization) to have static initialization in one translation unit and<br>
> dynamic initialization in another.<br>
><br>
> The approach we came up with was:<br>
><br>
>   * put the variable and its guard variable in a COMDAT together, as the<br>
> ABI document suggests (LLVM doesn't yet have the machinery for this)<br>
>   * if we constant-initialize a common variable, but we can't prove that<br>
> every other translation unit that sees it will also constant-initialize it,<br>
> emit a guard variable statically initialized to the 'already initialized'<br>
> value<br>
><br>
> ... but we've not implemented anything like this yet.<br>
<br>
</div>That explains it very well.  Thanks!<br>
<br>
Do you know if there is a bug filed for tracking progress on the<br>
issue?  I didn't see anything in Bugzilla but may not have been<br>
searching with the right keywords.</blockquote><div><br></div><div>I don't know of one; please go ahead and file one. Duplicates are cheap :) </div></div></div></div>