[libcxx-commits] [libcxx] [libcxx] Initialize vcruntime __std_exception_data in the exception copy ctor (PR #144329)
Martin Storsjö via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Aug 4 03:17:19 PDT 2025
================
@@ -48,7 +48,7 @@ class exception { // base of all library exceptions
__data_._DoFree = true;
}
- exception(exception const&) _NOEXCEPT {}
+ exception(exception const&) _NOEXCEPT : __data_() {}
----------------
mstorsjo wrote:
> Is there a reason we don't do a proper copy?
To properly do a copy, the real vcruntime here calls the `__std_exception_copy` helper function (to do a proper deep copy of the contained data structure). This dummy implementation here, used when compiling in the `no-vcruntime` setup, is intentionally a no-op - which is usually fine. However here the too-much-no-op case makes the compiler do incorrect conclusions when compiling with optimizations enabled.
> What happens if two TUs are linked where we provide our own implementation while the other is provided by vcruntime?
Not sure it this dummy implementation is being mangled differently to avoid collisions, or if that's a latent bug for anybody doing mixed bugs. Clearly a potential issue - but mostly orthogonal to this patch.
https://github.com/llvm/llvm-project/pull/144329
More information about the libcxx-commits
mailing list