llvm-project/compiler-rt/test/lsan/TestCases/use_globals_uninitialized.cpp
Kirill Stoimenov f9a0163098 [LSAN][HWASAN] Run LSAN tests with HWASAN enabled
A lot of tests are disabled by using UNSUPPORTED. The plan is to remove UNSUPPORTED for tests that are fixed.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D142676
2023-01-28 00:07:19 +00:00

25 lines
790 B
C++

// Test that uninitialized globals are included in the root set.
// RUN: %clangxx_lsan %s -o %t
// RUN: %env_lsan_opts="report_objects=1:use_stacks=0:use_registers=0:use_globals=0" not %run %t 2>&1 | FileCheck %s
// RUN: %env_lsan_opts="report_objects=1:use_stacks=0:use_registers=0:use_globals=1" %run %t 2>&1
// RUN: %env_lsan_opts="" %run %t 2>&1
// Fixme: remove once test passes with hwasan
// UNSUPPORTED: hwasan
#include <stdio.h>
#include <stdlib.h>
#include "sanitizer_common/print_address.h"
void *bss_var;
int main() {
bss_var = malloc(1337);
print_address("Test alloc: ", 1, bss_var);
return 0;
}
// CHECK: Test alloc: [[ADDR:0x[0-9,a-f]+]]
// CHECK: LeakSanitizer: detected memory leaks
// CHECK: [[ADDR]] (1337 bytes)
// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer: