-
Notifications
You must be signed in to change notification settings - Fork 14.9k
[NFC][Asan] Fix warning in test #155447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NFC][Asan] Fix warning in test #155447
Conversation
Created using spr 1.3.6
@llvm/pr-subscribers-compiler-rt-sanitizer Author: Vitaly Buka (vitalybuka) ChangesAfter #150028. Full diff: https://github.com/llvm/llvm-project/pull/155447.diff 1 Files Affected:
diff --git a/compiler-rt/lib/asan/tests/asan_test.cpp b/compiler-rt/lib/asan/tests/asan_test.cpp
index 2d054ee859ed4..92512c027e381 100644
--- a/compiler-rt/lib/asan/tests/asan_test.cpp
+++ b/compiler-rt/lib/asan/tests/asan_test.cpp
@@ -395,7 +395,8 @@ TEST(AddressSanitizer, ReallocTest) {
}
free(ptr);
// Realloc pointer returned by malloc(0).
- int *ptr2 = Ident((int*)malloc(0));
+ volatile void* ptr0 = malloc(0);
+ int *ptr2 = Ident((int*)ptr0);
ptr2 = Ident((int*)realloc(ptr2, sizeof(*ptr2)));
*ptr2 = 42;
EXPECT_EQ(42, *ptr2);
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe mention which warning in the commit message
done |
After #155447. It's not needed, but does not compile on PowerPC.
After #150028.
Warning: