Skip to content

Conversation

cpplearner
Copy link
Contributor

@cpplearner cpplearner commented May 23, 2024

memory_resource requires that the value passed to deallocate matches the argument of allocate ([mem.res.private]/4). Apparently this matters for ASAN (see https://lab.llvm.org/buildbot/#/builders/168/builds/20464).

@cpplearner cpplearner requested a review from a team as a code owner May 23, 2024 02:43
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label May 23, 2024
@llvmbot
Copy link
Member

llvmbot commented May 23, 2024

@llvm/pr-subscribers-libcxx

Author: S. B. Tam (cpplearner)

Changes

memory_resource requires that the value passed to deallocate matches the argument of allocate ([[mem.res.private]/4](http://eel.is/c++draft/mem.res.private#4)). Apparently this matters for ASAN.


Full diff: https://github.com/llvm/llvm-project/pull/93126.diff

1 Files Affected:

  • (modified) libcxx/test/std/utilities/utility/mem.res/mem.res.global/new_delete_resource.pass.cpp (+1-1)
diff --git a/libcxx/test/std/utilities/utility/mem.res/mem.res.global/new_delete_resource.pass.cpp b/libcxx/test/std/utilities/utility/mem.res/mem.res.global/new_delete_resource.pass.cpp
index 68a82f6ce90b3..7b3107029d4d8 100644
--- a/libcxx/test/std/utilities/utility/mem.res/mem.res.global/new_delete_resource.pass.cpp
+++ b/libcxx/test/std/utilities/utility/mem.res/mem.res.global/new_delete_resource.pass.cpp
@@ -76,7 +76,7 @@ void test_allocate_deallocate() {
   ASSERT_WITH_LIBRARY_INTERNAL_ALLOCATIONS(globalMemCounter.checkOutstandingNewEq(1));
   ASSERT_WITH_LIBRARY_INTERNAL_ALLOCATIONS(globalMemCounter.checkLastNewSizeEq(50));
 
-  r1.deallocate(ret, 1);
+  r1.deallocate(ret, 50);
   assert(globalMemCounter.checkOutstandingNewEq(0));
   ASSERT_WITH_LIBRARY_INTERNAL_ALLOCATIONS(globalMemCounter.checkDeleteCalledEq(1));
 }

@cpplearner
Copy link
Contributor Author

dup of #93145

@cpplearner cpplearner closed this May 23, 2024
@cpplearner cpplearner deleted the cpplearner-patch-1 branch May 23, 2024 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants