[libcxx-dev] How do _LIBCPP_DEBUG=1 "debug iterators" ever work, when linking against libc++.a?

Mark de Wever via libcxx-dev libcxx-dev at lists.llvm.org
Sat May 29 10:00:15 PDT 2021


On Sat, May 08, 2021 at 04:49:20PM -0400, Arthur O'Dwyer via libcxx-dev wrote:
> Gentle bump.
>
> Quoting myself for emphasis:
> >
> > The problem seems to be that
> > (1) libc++.a needs to copy strings sometimes, so it contains codegen for
> the copy constructor
> > (2) libc++.a is compiled with -D_LIBCPP_DEBUG=0, i.e., assertions but no
> debug iterators
> > (3) Therefore any strings created by the copy constructor inside
> libc++.a, don't get registered with the debug-iterators library
> > (4) Therefore pretty much everything is affected by unpredictable
> assert-fails??
> >
> > The real question is, how was this ever *supposed* to work?

It seems the issue also happens with strings returned from
std::to_string. This function is implemented in src/string.cpp.
I ran into it a while ago while implementing the std::formatter stubs.

(I actually forgot about this issue, but Arthur reminded me.)

To me it seems unintentional and unwanted. But I don't have a suggestion
how to fix it.

Cheers,
Mark de Wever


More information about the libcxx-dev mailing list