[compiler-rt] [ASan] Add xfail test for PR #213546 (PR #216532)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 15 20:06:36 PDT 2026
https://github.com/flovent created https://github.com/llvm/llvm-project/pull/216532
None
>From 9e1a058b16a37c5107a0344f411d8b7d017aab6e Mon Sep 17 00:00:00 2001
From: flovent <flbven at protonmail.com>
Date: Sun, 16 Aug 2026 09:42:28 +0800
Subject: [PATCH] Add xfail test
---
.../invalid-pointer-pairs-vector-extract.cpp | 32 +++++++++++++++++++
1 file changed, 32 insertions(+)
create mode 100644 compiler-rt/test/asan/TestCases/invalid-pointer-pairs-vector-extract.cpp
diff --git a/compiler-rt/test/asan/TestCases/invalid-pointer-pairs-vector-extract.cpp b/compiler-rt/test/asan/TestCases/invalid-pointer-pairs-vector-extract.cpp
new file mode 100644
index 0000000000000..6de635b3f95b0
--- /dev/null
+++ b/compiler-rt/test/asan/TestCases/invalid-pointer-pairs-vector-extract.cpp
@@ -0,0 +1,32 @@
+// REQUIRES: asserts
+// RUN: %clangxx_asan -O2 %s -o %t -mllvm -asan-detect-invalid-pointer-pair
+// RUN: %env_asan_opts=detect_invalid_pointer_pairs=1:halt_on_error=0 %run %t 2>&1 | FileCheck %s
+// RUN: %env_asan_opts=detect_invalid_pointer_pairs=2:halt_on_error=0 %run %t 2>&1 | FileCheck %s
+
+// XFAIL: *
+
+#include <stdio.h>
+#include <stdlib.h>
+
+__attribute__((noinline)) void span_lengths(const char **begins,
+ const char **ends, long *lengths) {
+ // CHECK: ERROR: AddressSanitizer: invalid-pointer-pair
+ // CHECK: #{{[0-9]+ .*}} in span_lengths
+ lengths[0] = ends[0] - begins[0];
+ // CHECK: ERROR: AddressSanitizer: invalid-pointer-pair
+ // CHECK: #{{[0-9]+ .*}} in span_lengths
+ lengths[1] = ends[1] - begins[1];
+}
+
+int main() {
+ char *a = (char *)malloc(16);
+ char *b = (char *)malloc(16);
+ const char *begins[2] = {a, b};
+ const char *ends[2] = {b + 2, a + 10};
+ long lengths[2] = {0};
+ span_lengths(begins, ends, lengths);
+ fprintf(stderr, "lengths: %ld %ld\n", lengths[0], lengths[1]);
+ free(a);
+ free(b);
+ return 0;
+}
More information about the llvm-commits
mailing list