<div dir="auto"><div dir="auto"></div>I've committed a fix, though I was unable to reproduce the problem with unit tests.<div dir="auto"><div dir="auto"><br></div><div dir="auto"><a href="https://github.com/llvm/llvm-project/commit/a9245e4f86165ac38a297138fff08cd4eb7255a7">https://github.com/llvm/llvm-project/commit/a9245e4f86165ac38a297138fff08cd4eb7255a7</a></div><div dir="auto"><br></div><div dir="auto">Could you please confirm it on your end?</div><div dir="auto"><br><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">On Sun, Dec 8, 2019, 6:52 AM Idan Freiberg via libcxx-dev <<a href="mailto:libcxx-dev@lists.llvm.org" target="_blank" rel="noreferrer">libcxx-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello,<div><br></div><div>I believe iv'e identified an issue with libcxxabi.</div><div>The symptom is that, when calling std::treminate() on some simple program, the program segfaults.</div><div><br></div><div>After a bit of debugging libcxxabi, Iv'e noticed that `__cxa_terminate_handler` is NULL at program initialization. However, calling std::set_terminate(nullptr); sets the actual default terminate handler (in my case is just std::abort). </div><div><br></div><div>I tend to believe this is related to an static initialization order issue, in which `__cxa_terminate_handler`  doesn't not get this correct value of std::abort (set by <span style="color:rgb(36,41,46);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre-wrap">default_terminate_handler). </span></div><div><a href="https://github.com/llvm/llvm-project/blob/master/libcxxabi/src/cxa_default_handlers.cpp#L96" rel="noreferrer noreferrer" target="_blank">https://github.com/llvm/llvm-project/blob/master/libcxxabi/src/cxa_default_handlers.cpp#L96</a></div><div><br></div><div>One solution for iv'e found is wrapping the <span style="color:rgb(36,41,46);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre-wrap">default_terminate_handler with a function and set this function as </span>__cxa_terminate_handler first.</div><div><br></div><div>I would be happy to hear your insights about this.<br clear="all"><div><br></div>-- <br><div dir="ltr" data-smartmail="gmail_signature"><div dir="ltr"><div><span style="font-family:arial;font-size:small">Idan Freiberg</span></div><span style="font-family:arial;font-size:small">Mobile: +972-52-2925213</span><br></div></div></div></div>
_______________________________________________<br>
libcxx-dev mailing list<br>
<a href="mailto:libcxx-dev@lists.llvm.org" rel="noreferrer noreferrer" target="_blank">libcxx-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/libcxx-dev" rel="noreferrer noreferrer noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/libcxx-dev</a><br>
</blockquote></div></div></div></div>