[llvm-branch-commits] [compiler-rt] release/21.x: [scudo] Make Ptr volatile so that the malloc and free calls are not optimized out (#149944) (PR #151201)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Jul 29 10:53:34 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-compiler-rt-sanitizer
Author: None (llvmbot)
<details>
<summary>Changes</summary>
Backport fcdcc4ea7ac960c79246b3bd428f14ea350e63e2
Requested by: @<!-- -->mgorny
---
Full diff: https://github.com/llvm/llvm-project/pull/151201.diff
1 Files Affected:
- (modified) compiler-rt/lib/scudo/standalone/tests/wrappers_c_test.cpp (+2-1)
``````````diff
diff --git a/compiler-rt/lib/scudo/standalone/tests/wrappers_c_test.cpp b/compiler-rt/lib/scudo/standalone/tests/wrappers_c_test.cpp
index 05065444a70c5..612317b3c3293 100644
--- a/compiler-rt/lib/scudo/standalone/tests/wrappers_c_test.cpp
+++ b/compiler-rt/lib/scudo/standalone/tests/wrappers_c_test.cpp
@@ -183,7 +183,8 @@ TEST_F(ScudoWrappersCDeathTest, Malloc) {
// process doing free(P) is not a double free.
EXPECT_DEATH(
{
- void *Ptr = malloc(Size);
+ // Note: volatile here prevents the calls from being optimized out.
+ void *volatile Ptr = malloc(Size);
free(Ptr);
free(Ptr);
},
``````````
</details>
https://github.com/llvm/llvm-project/pull/151201
More information about the llvm-branch-commits
mailing list