[libcxx-commits] [libcxx] [ASan][libc++] Annotating `std::basic_string` with all allocators (PR #75845)
via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Dec 19 12:24:14 PST 2023
================
@@ -0,0 +1,78 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: asan
+// UNSUPPORTED: c++03
+
+// <string>
+
+// Test based on: https://bugs.chromium.org/p/chromium/issues/detail?id=1419798#c5
+// Some allocators during deallocation may not call destructors and just reuse memory.
----------------
EricWF wrote:
Allocators don't destroy things internally, but the standard library may use an allocator to call a destructor.
Does this mean to say "Some allocators don't call free from deallocate?" which would leave the memory in the state string left it in?
If we really do mean "There's code that reuses the memory of live objects without destroying them", then that's exactly the kind of bug ASAN is meant to catch. That is not UB we should accept.
https://github.com/llvm/llvm-project/pull/75845
More information about the libcxx-commits
mailing list