bolt/deps/llvm-18.1.8/compiler-rt/test/lsan/TestCases/user_pointer.cpp

18 lines
378 B
C++
Raw Normal View History

2025-02-14 19:21:04 +01:00
// Checks if a user pointer is found by the leak sanitizer.
// RUN: %clang_lsan %s -o %t
// RUN: %run %t 2>&1
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
uintptr_t glob[1024];
int main() {
for (int i = 0; i < 1024; ++i) {
// Check that the pointers will not be falsely reported as leaks.
glob[i] = (uintptr_t)malloc(sizeof(int *));
}
return 0;
}