[compiler-rt] [NFC][sanitizer] Add test for length sub-specifier "z" (PR #128448)

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 23 17:19:19 PST 2025


https://github.com/vitalybuka created https://github.com/llvm/llvm-project/pull/128448

None

>From 78c817662ec378e06487cea116d5c802ce7a261a Mon Sep 17 00:00:00 2001
From: Vitaly Buka <vitalybuka at google.com>
Date: Sun, 23 Feb 2025 17:19:04 -0800
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
 =?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4
---
 .../tests/sanitizer_format_interceptor_test.cpp                | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/compiler-rt/lib/sanitizer_common/tests/sanitizer_format_interceptor_test.cpp b/compiler-rt/lib/sanitizer_common/tests/sanitizer_format_interceptor_test.cpp
index de96e573ab844..18f5da2f23b14 100644
--- a/compiler-rt/lib/sanitizer_common/tests/sanitizer_format_interceptor_test.cpp
+++ b/compiler-rt/lib/sanitizer_common/tests/sanitizer_format_interceptor_test.cpp
@@ -38,6 +38,7 @@ using namespace __sanitizer;
 #include "sanitizer_common/sanitizer_common_interceptors_format.inc"
 
 static const unsigned I = sizeof(int);
+static const unsigned Z = sizeof(size_t);
 static const unsigned L = sizeof(long);
 static const unsigned LL = sizeof(long long);
 static const unsigned S = sizeof(short);
@@ -113,6 +114,8 @@ static void testScanfNoGnuMalloc(const char *format, unsigned n, ...) {
 
 TEST(SanitizerCommonInterceptors, Scanf) {
   testScanf("%d", 1, I);
+  testScanf("%zx", 1, Z);
+  testScanf("%zd", 1, Z);
   testScanf("%d%d%d", 3, I, I, I);
   testScanf("ab%u%dc", 2, I, I);
   testScanf("%ld", 1, L);



More information about the llvm-commits mailing list