<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Oct 29, 2021, at 11:29, Arthur O'Dwyer via libcxx-dev <<a href="mailto:libcxx-dev@lists.llvm.org" class="">libcxx-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div dir="ltr" class="">On Fri, Oct 29, 2021 at 9:09 AM Stephan Bergmann via libcxx-dev <<a href="mailto:libcxx-dev@lists.llvm.org" class="">libcxx-dev@lists.llvm.org</a>> wrote:<br class=""></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">At least with recent LLVM 14 trunk,<br class="">[...]<br class="">
> Segmentation fault<br class="">[...]<br class="">
because the std::string instance returned from std::to_string <br class="">
(implemented in libc++, not itself built with -D_LIBCPP_DEBUG=1) never <br class="">
called __libcpp_db::__insert_c(this), so __libcpp_db::swap doesn't find <br class="">
it in the __cbeg_/__cend_ table and then dereferences a null pointer.<br class="">
<br class="">
I wonder how usable and mature -D_LIBCPP_DEBUG=1 is considered in <br class="">
practice.  Is this a well-known shortcoming (in which case it might be <br class="">
good to mention it explicitly in libcxx/docs/DesignDocs/DebugMode.rst, <br class="">
beyond just "Users should compile their whole program at the same <br class="">
debugging level."), or would it be worth filing a bug?<br class=""></blockquote></div></div></div></blockquote><div><br class=""></div><div>On the maturity level: libc++'s debugging mode is quite broken at the moment, however it is on my high priority list of things to fix.</div><div>That being said, even after it is fixed, you will *not* be able to just `#define _LIBCPP_DEBUG 1` in your own translation unit.</div><div>You will need to use a libc++ that has been built for the debug mode in order for things to work.</div><div><br class=""></div><div>However, once I'm done fixing the mess, you should be able to use something akin to #define _LIBCPP_ENABLE_ASSERTIONS</div><div>to get most non-ABI-or-performance-altering assertions enabled in just your TU. Things such as assertions if you index a</div><div>vector beyond its bounds.</div><div><br class=""></div><div>Cheers,</div><div>Louis</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_quote"><div class=""><br class=""></div><div class="">Just to link up the two threads: I ran into this earlier this year.</div><div class=""><a href="https://lists.llvm.org/pipermail/libcxx-dev/2021-May/001119.html" class="">https://lists.llvm.org/pipermail/libcxx-dev/2021-May/001119.html</a><br class=""></div><div class="">It is the reason at least one test in libcxx/test/ is marked "LIBCXX-DEBUG-FIXME". I don't have any ideas how to fix it, though.</div></div></div></div></blockquote><br class=""></div><div><br class=""></div><br class=""></body></html>