Skip to content

[libc++] v2 ABI silently introduces new non-conforming behaviour for smart pointer destruction #142066

Open
@jrtc27

Description

@jrtc27

_LIBCPP_ABI_ENABLE_UNIQUE_PTR_TRIVIAL_ABI and _LIBCPP_ABI_ENABLE_SHARED_PTR_TRIVIAL_ABI are enabled for libc++'s v2 ABI and above (and unstable ABI). As documented in libcxx/docs/DesignDocs/UniquePtrTrivialAbi.rst (but that does not mention it's enabled by default for v2 and above), this is a non-conforming implementation that can lead to destructors being called in an order not permitted by the standard. Whilst I understand the appeal of the performance gain these options give, libc++ should not deliberately and silently be regressing standards conformance in the name of performance as part of opting into its v2 ABI. I would consider this a blocker for FreeBSD ever adopting that new ABI; we've had enough pain from adopting libc++ before it had a conforming std::pair implementation and having to maintain and keep providing that non-conformance for ABI compatibility despite it breaking real-world software. Maybe this one is harmless in practice, but any non-conformance has the potential to cause problems, and this would be a strict regression over v1.

These options should be split out from the ABI version, as an explicit opt-in for platforms to use should they view the performance gain worth the non-conformance. libc++'s v2 ABI should by default conform to the specification as fully as possible.

Cc @dim @emaste as it pertains to libc++ in FreeBSD

Metadata

Metadata

Assignees

No one assigned

    Labels

    libc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions