[compiler-rt] c5ea9b8 - [test][asan] Make the printf-5.c test case actually emit a volatile memcpy.
Patrick Walton via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 30 13:20:51 PDT 2022
Author: Patrick Walton
Date: 2022-10-30T13:20:36-07:00
New Revision: c5ea9b8a51ddcd5121ec1bcad7b034c8aa692f52
URL: https://github.com/llvm/llvm-project/commit/c5ea9b8a51ddcd5121ec1bcad7b034c8aa692f52
DIFF: https://github.com/llvm/llvm-project/commit/c5ea9b8a51ddcd5121ec1bcad7b034c8aa692f52.diff
LOG: [test][asan] Make the printf-5.c test case actually emit a volatile memcpy.
The current test in printf-5.c appears to try to emit a volatile memcpy for the
format string, but it doesn't because the volatile qualifier is implicitly
casted away. Using a string literal instead preserves the volatile qualifier.
This is a follow-up to D137031 and is a prerequisite for D136822, which elides
memcpys in more instances and would otherwise break this test.
Differential Revision: https://reviews.llvm.org/D137042
Added:
Modified:
compiler-rt/test/asan/TestCases/printf-5.c
Removed:
################################################################################
diff --git a/compiler-rt/test/asan/TestCases/printf-5.c b/compiler-rt/test/asan/TestCases/printf-5.c
index 2257bb4e61aab..89d3a333ba1d7 100644
--- a/compiler-rt/test/asan/TestCases/printf-5.c
+++ b/compiler-rt/test/asan/TestCases/printf-5.c
@@ -14,8 +14,7 @@ int main() {
volatile int x = 12;
volatile float f = 1.239;
volatile char s[] = "34";
- volatile char fmt[2];
- memcpy((char *)fmt, "%c %d %f %s\n", sizeof(fmt));
+ volatile char fmt[2] = "%c %d %f %s\n";
printf((char *)fmt, c, x, f, s);
return 0;
// Check that format string is sanitized.
More information about the llvm-commits
mailing list